pazi4ka

index.php

Feb 24th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Список варнов</title>
  7. <style>
  8. body {
  9. font-family: Arial, sans-serif;
  10. background-color: #333;
  11. color: #eee;
  12. margin: 0;
  13. padding: 20px;
  14. }
  15.  
  16. .container {
  17. max-width: 800px;
  18. margin: 0 auto;
  19. }
  20.  
  21. table {
  22. width: 100%;
  23. border-collapse: collapse;
  24. margin-top: 20px;
  25. }
  26.  
  27. th,
  28. td {
  29. padding: 8px;
  30. text-align: left;
  31. border-bottom: 1px solid #666;
  32. }
  33.  
  34. th {
  35. background-color: #444;
  36. }
  37.  
  38. tr:nth-child(even) {
  39. background-color: #555;
  40. }
  41.  
  42. tr:hover {
  43. background-color: #777;
  44. }
  45.  
  46. h1 {
  47. text-align: center;
  48. }
  49. </style>
  50. </head>
  51. <body>
  52. <div class="container">
  53. <h1>Список варнов</h1>
  54. <table>
  55. <thead>
  56. <tr>
  57. <th>ID</th>
  58. <th>Игрок</th>
  59. <th>Истекает</th>
  60. <th>Причина</th>
  61. <th>Выдал</th>
  62. </tr>
  63. </thead>
  64. <tbody id="warns-table-body">
  65. <?php
  66. $servername = "localhost";
  67. $username = "jd";
  68. $password = "rWsB9Q";
  69. $dbname = "sw";
  70.  
  71. $conn = new mysqli($servername, $username, $password, $dbname);
  72.  
  73.  
  74. if ($conn->connect_error) {
  75. die("Ошибка подключения к базе данных: " . $conn->connect_error);
  76. }
  77.  
  78. $sql = "SELECT * FROM warns";
  79. $result = $conn->query($sql);
  80.  
  81. if ($result->num_rows > 0) {
  82. while($row = $result->fetch_assoc()) {
  83. echo "<tr>";
  84. echo "<td>" . $row["warnID"] . "</td>";
  85. echo "<td>" . $row["playerName"] . "</td>";
  86. echo "<td>" . $row["expiry"] . "</td>";
  87. echo "<td>" . $row["reason"] . "</td>";
  88. echo "<td>" . $row["issuer"] . "</td>";
  89. echo "</tr>";
  90. }
  91. } else {
  92. echo "<tr><td colspan='5'>Нет варнов в базе данных.</td></tr>";
  93. }
  94. $conn->close();
  95. ?>
  96. </tbody>
  97. </table>
  98. </div>
  99. <script>
  100. setInterval(function() {
  101. location.reload();
  102. }, 5000);
  103. </script>
  104. </body>
  105. </html>
  106.  
Advertisement
Add Comment
Please, Sign In to add comment