Advertisement
Nautiluss

forum

May 14th, 2024
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.20 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $db = mysqli_connect("localhost", "root", "", "forum");
  5.  
  6.  
  7.  
  8. if(isset($_SESSION['id'])) {
  9.     if($_SESSION['rule'] > 1) {
  10.     echo "
  11.    <form style='border:none; background:#141E26 ;position: relative; top:-20%; left:43%; width: 99%; height: 150px;' action='create_topic.php' method='post' >
  12.        <input style='border:none; top: 10%; width: 15%; left:5%; position:absolute;' type='text'  name='topic_title'maxlength='12' placeholder='Имя топика'>
  13.        <input  class='wow' style='width: 15%; left:5%; position:absolute; top:55%; font-size: 14px; border:none; background:#11191F; color:white;' type='submit' value='Создать топик'>
  14.        <label class='wow' style='color:white; position: absolute; top: 20%; left: 25%;'>Доступно для:</label>
  15.        <select  style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: absolute; top: 27%; left: 37%;' name='permissions'>
  16.            <option value='defoult'>Все</option>
  17.            <option value='avtor'>Авторитет </option>
  18.            <option value='verifed'>Проверенный</option>
  19.            <option value='admin'>Администратор</option>
  20.        </select>    
  21.        <label class='wow' style='color:white; position: absolute; top: 50%; left: 25%;'>Префикс темы:</label>
  22.        <select style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: absolute; top: 57%; left: 43%;' name='topic_prefix'>
  23.            <option value='Обычная'>Обычная</option>
  24.            <option value='https://iimg.su/s/06/th_hYbU8DPQ69F16k46UeX3zbxHdw3tfig2qvldZKze.png'>Важно</option>
  25.            <option value='https://iimg.su/s/06/th_aqvflVXNGUTJfeJ1uTT2Nxuxe6R3AkMhrw7UKYMP.png'>Инфо</option>
  26.            <option value='https://iimg.su/s/06/th_Uwi5iujDUfrfMNeuS0d4DNgn8g8nPlIfSWSXrGYv.png'>Новое</option>
  27.        </select>    
  28.    </form>
  29. ";
  30.     }else{
  31.         echo "
  32.        <form style='border:none; background:#141E26 ;position: relative; top:-20%; left:43%; width: 99%; height: 150px;' action='create_topic.php' method='post' >
  33.        <input style='border:none; top: 10%; width: 15%; left:5%; position:absolute;' type='text'  name='topic_title'maxlength='12' placeholder='Имя топика'>
  34.        <input  class='wow' style='width: 15%; left:5%; position:absolute; top:55%; font-size: 14px; border:none; background:#11191F; color:white;' type='submit' value='Создать топик'>
  35.        <label class='wow' style='color:white; position: absolute; top: 20%; left: 25%;'>Доступно для:</label>
  36.        <select  style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: absolute; top: 27%; left: 37%;' name='permissions'>
  37.            <option value='defoult'>Все</option>
  38.        </select>    
  39.        <label class='wow' style='color:white; position: absolute; top: 50%; left: 25%;'>Префикс темы:</label>
  40.        <select style='border: 1px solid #999; font-size: 18px; color: #ffffff; background-color: #141E26; border-radius: 5px; position: absolute; top: 57%; left: 43%;' name='topic_prefix'>
  41.            <option value='Обычная'>Обычная</option>
  42.            <option value='https://iimg.su/s/06/th_Uwi5iujDUfrfMNeuS0d4DNgn8g8nPlIfSWSXrGYv.png'>Новое</option>
  43.        </select>    
  44.    </form>
  45.    
  46. ";
  47.     }
  48. } else {
  49.     echo "Пожалуйста <a href='index.php'>Войдите</a> для оставления сообщений.";
  50. }
  51.  
  52. echo"
  53. <form style='position:relative; top:-35%; left: 70%; ' action='search.php' method='GET'>
  54. <input type='text' name='query' placeholder='Введите ваш запрос'>
  55. <button  type='submit'>Искать</button>
  56. </form>
  57. ";
  58.  
  59. include 'db_conn.php'; // Подключаем файл для соединения с БД
  60.  
  61. // SQL запрос для получения списка тем
  62. $sql = "SELECT * FROM topics";
  63. $result = $conn->query($sql);
  64. echo "<div style='width: 1000px; height: 1px; position: relative; margin-bottom: 60px'>"; // Добавлено margin-bottom: 60px для отступа между рамками
  65. if ($result->num_rows > 0) {
  66.     // Вывод списка тем
  67.     while($row = $result->fetch_assoc()) {
  68.         $user_id = $row['user_id'];
  69.         $query = mysqli_query($db, "SELECT * FROM `users` WHERE `id`='{$user_id}'");
  70.         $array = mysqli_fetch_array($query);
  71.         echo "<div style='width: 1000px; height: 25px; position: relative; left:43%; margin-bottom: 60px'>"; // Добавлено margin-bottom: 60px для отступа между рамками
  72.         echo "<a href='topic.php?id=".$row["topic_id"]."'>";
  73.         echo "<div style='width: 1000px; height: 70px; left: 0px; top: 0px; position: absolute; background: #141E26; border-radius: 50px'></div>";
  74.         echo "<div style='width: 300px; height: 32px; left: 304px; top: 21px; position: absolute; color: white; font-size: 24px; font-family: Montserrat Bold; font-weight: 700; word-wrap: break-word'>".$row["topic_title"]."</div>";
  75.         echo "<div style='width: 400px; height: 37px; left: 600px; top: 21px; position: absolute; color: white; font-size: 24px; font-family: Montserrat Bold; font-weight: 700; word-wrap: break-word'>Автор: ".$array['user_name']."</div>";
  76.         echo "<div style='width: 168px; height: 31px; left: 57px; top: 21px; position: absolute; color: white; font-size: 24px; font-family: Montserrat Bold; font-weight: 700; word-wrap: break-word'><div style=' position: absolute; top:-15%; left:-10%; width: 80px; height: 35px; font-size: 0px; background:url(".$row["topic_prefix"].");'> </div></div>";
  77.         echo "</div>";
  78.         echo "</a>";
  79.     }
  80. } else {
  81. }
  82.  
  83.  
  84. ?>
  85.  
  86. <!DOCTYPE html>
  87. <html id="suka">
  88. <head>
  89.     <title>Forum</title>
  90.     <link rel="stylesheet" type="text/css" href="style.css">
  91.     <link rel="stylesheet" href="fonts/fonts.css">
  92. </head>
  93. <body style="background: #11191F; display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column;">
  94. <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">
  95.     <img style=" position:absolute; top:5%; left:5%; width: 80px; height: 80px; border-radius: 9999px" src="src/media/logo.png" />
  96.   </div>
  97.   <div style="position:fixed; top:9vh; left:13vh; width: 175px; height: 30px; padding: 10px; justify-content: center; align-items: center; display: inline-flex">
  98.     <a href="index.php" class="mont" style="text-decoration: none;">UNO-WTF.TK</a>
  99.   </div>
  100.   <div>
  101.   <a href="home.php" class="mont" style="position:fixed; text-decoration: none; top:9vh; right:20vh;  width: 205px; height: 30px; padding: 10px;" >Личный кабинет</a>
  102.   <a href="forum.php" class="mont" style="position:fixed; text-decoration: none; top:9vh; right:5vh;  width: 100px; height: 30px; padding: 10px;">Форум</a>
  103.   </div>
  104.   </body>
  105.      <script src="./src/visual/dop.js"></script>
  106.      <script src="./src/visual/back.js"></script>
  107.      <script src="./src/visual/app.js"></script>
  108. </body>
  109. </html>
  110.  
  111.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement