Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html id="#suka">
- <head>
- <title>Forum: <?php echo $row_topic["topic_title"];?> </title>
- <link rel="stylesheet" type="text/css" href="style.css">
- <link rel="stylesheet" href="fonts/fonts.css">
- <script src="script.js"></script>
- </head>
- <body style="background: #11191F; display: flex; justify-content: center; align-items: center; height: 100%; flex-direction: column;" >
- <div style="position:fixed; top:5vh; left:5vh; width: 100px; height: 100px; justify-content: flex-start; align-items: flex-start; gap: 10px; display: inline-flex">
- <img style=" position:absolute; top:5%; left:5%; width: 80px; height: 80px; border-radius: 9999px" src="src/media/logo.png" />
- </div>
- <div style="position:fixed; top:9vh; left:13vh; width: 175px; height: 30px; padding: 10px; justify-content: center; align-items: center; display: inline-flex">
- <a href="index.php" class="mont" style="text-decoration: none;">UNO-WTF.TK</a>
- </div>
- <div>
- <a href="home.php" class="mont" style="position:fixed; text-decoration: none; top:9vh; right:20vh; width: 205px; height: 30px; padding: 10px;" >Личный кабинет</a>
- <a href="forum.php" class="mont" style="position:fixed; text-decoration: none; top:9vh; right:5vh; width: 100px; height: 30px; padding: 10px;">Форум</a>
- </div>
- </body>
- <script src="./src/visual/dop.js"></script>
- <script src="./src/visual/back.js"></script>
- <script src="./src/visual/app.js"></script>
- </body>
- </html>
- <?php
- session_start();
- include 'db_conn.php'; // Подключаем файл для соединения с БД
- // Проверяем, был ли передан идентификатор темы в URL
- if(isset($_GET['id']) && !empty($_GET['id'])) {
- $topic_id = $_GET['id'];
- // SQL запрос для получения информации о выбранной теме
- $sql_topic = "SELECT * FROM topics WHERE topic_id = $topic_id";
- $result_topic = $conn->query($sql_topic);
- if ($result_topic->num_rows > 0) {
- $row_topic = $result_topic->fetch_assoc();
- echo "<h1 class='wow'style='left:44.5vh; position:relative;'>".$row_topic["topic_title"]."</h1>";
- } else {
- echo "Topic not found.";
- }
- // SQL запрос для получения сообщений в выбранной теме
- $sql_messages = "SELECT * FROM messages WHERE topic_id = $topic_id";
- $result_messages = $conn->query($sql_messages);
- if ($result_messages->num_rows > 0) {
- // Вывод сообщений
- while($row_message = $result_messages->fetch_assoc()) {
- echo "<div style='margin: 1%; width: 1000px; min-height: 100px; height: fit-content; left: 0px; top: 0px; position: relative; left:44.5vh; background: #141E26; color: white; font-size: 24px; font-family: Montserrat Bold; font-weight: 700; word-wrap: break-word'>".$row_message["message_text"]."</div>";
- }
- } else {
- echo "No messages found.";
- }
- }
- // Форма для добавления нового сообщения
- if(isset($_SESSION['id'])) {
- echo "
- <form action='add_message.php' method='post' style='width:1060px; hight:600px; left:43%; position: relative; top: 100%;'>
- <select id='mySelect' onchange='callFunction()' style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: relative; left:2.5%; '>
- <option value='0'>Выберите цвет текста</option>
- <option value='1'>Красный</option>
- <option value='2'>Синий</option>
- <option value='3'>Зеленый</option>
- <option value='4'>Белый</option>
- </select>
- <select id='mySelectHui' onchange='callFunctionHui()' style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: relative; left:2.5%; '>
- <option value='0'>Выберите цвет обводки</option>
- <option value='1'>Красный</option>
- <option value='2'>Розовый</option>
- <option value='3'>Синий</option>
- <option value='4'>Белый</option>
- <option value='5'>Зеленый</option>
- </select>
- <textarea id='myTextarea' name='message_text' placeholder='Enter your message' rows='4' cols='50' style='resize:none; position: relative; left:2.5%; width:1000px; hight:400px;'></textarea><br>
- <input type='hidden' name='topic_id' value='$topic_id'>
- <input type='submit' value='Post Message'>\
- </form>
- ";
- } else {
- echo "Пожалуйста <a href='index.php'>Войдите</a> для оставления сообщений.";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement