Dragon_Saphir

Untitled

Sep 28th, 2020 (edited)
1,065
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <title>Notfunk Referat Adminzugang</title>
  6.  
  7. <?php
  8. require 'config-abfrage.php';
  9.  
  10. $db_link = mysqli_connect (
  11.                      MYSQL_HOST,
  12.                      MYSQL_BENUTZER,
  13.                      MYSQL_KENNWORT,
  14.                      MYSQL_DATENBANK
  15.                     );
  16.                    
  17. $sql = "SELECT * FROM bereitschaftslog ORDER BY id DESC";
  18.  
  19. $db_erg = mysqli_query( $db_link, $sql );
  20. if ( ! $db_erg )
  21. {
  22.     die('Ungültige Abfrage: ' . mysqli_error($db_link));
  23. }
  24.  
  25. if($_POST['status'] == "qrv")
  26. {
  27.     $date = $_POST['date'];
  28.     $time = $_POST['time'];
  29.     $user = $_POST['user'];
  30.     $rang = $_POST['rang'];
  31.     $status = $_POST['status'];
  32.     $sql_aktiv = "INSERT INTO bereitschaftslog(date, time, user, rang, status) VALUES ($date, $time, $user, $rang, $status)";
  33.     $db_erg_aktiv = mysqli_query( $db_link, $sql_aktiv );
  34.     if ( ! $db_erg_aktiv )
  35.     {
  36.         die('Ungültige Abfrage: ' . mysqli_error($db_link));
  37.     }
  38.     echo "qrv";
  39. }
  40. else if($_POST['status'] == "qrt")
  41. {
  42.     $date = $_POST['date'];
  43.     $time = $_POST['time'];
  44.     $user = $_POST['user'];
  45.     $rang = $_POST['rang'];
  46.     $status = $_POST['status'];
  47.     echo
  48.    
  49.     $sql_inaktiv = "INSERT INTO bereitschaftslog(date, time, user, rang, status) VALUES ($date, $time, $user, $rang, $status)";
  50.     $db_erg_inaktiv = mysqli_query( $db_link, $sql_inaktiv );
  51.     if ( ! $db_erg_inaktiv )
  52.     {
  53.         die('Ungültige Abfrage: ' . mysqli_error($db_link));
  54.     }
  55.     echo "qrt";
  56. }
  57.  
  58. echo '<table border="1">';
  59. echo "<tr>";
  60. echo "<td>". "<b>Datum</b>" . "</td>";
  61. echo "<td>". "<b>Uhrzeit</b>" . "</td>";
  62. echo "<td>". "<b>User</b>" . "</td>";
  63. echo "<td>". "<b>Rang</b>" . "</td>";
  64. echo "<td>". "<b>Status</b>" . "</td>";
  65. echo "</tr>";
  66. while ($zeile = mysqli_fetch_array( $db_erg, MYSQLI_ASSOC))
  67. {
  68.     echo "<tr>";
  69.     echo "<td>". $zeile['date'] . "</td>";
  70.     echo "<td>". $zeile['time'] . "</td>";
  71.     echo "<td>". $zeile['user'] . "</td>";
  72.     echo "<td>". $zeile['rang'] . "</td>";
  73.     echo "<td>". $zeile['status'] . "</td>";
  74.     echo "</tr>";
  75. }
  76. echo "</table>";
  77.  
  78. mysqli_free_result( $db_erg );
  79.  
  80. echo "</br></br>";
  81. ?>
  82.  
  83. <form action="admin.php" method="post">
  84. Datum:
  85. <input type="text" name="date">
  86. Uhrzeit:
  87. <input type="text" name="time">
  88. User:
  89. <input type="text" name="user">
  90. Rang:
  91. <input type="text" name="rang">
  92.  
  93. <button type="submit" name="status" value="qrv">QRV</button>
  94. <button type="submit" name="status" value="qrt">QRT</button>
  95. </form>
  96.  
  97. </br>
  98. </br>
  99.  
  100. <form action = "index.php">
  101. <input type="submit" name="zurück" value="zurück"/>
  102. </form>
  103.  
  104. </body>
  105. </html>
RAW Paste Data