Advertisement
meigrafd

dukennstmichnicht

Sep 5th, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if (!isset($_SESSION["username"])) {
  5.     echo "Bitte erst anmelden, <a href=\"" . include('../../itable/include/link-login-3.php') . "\">hier</a>.";
  6.     exit();
  7. }
  8.  
  9. include('../../include/db_config2.php');
  10.  
  11. if (isset($_POST["id"]) AND !empty($_POST["id"])) {
  12.     $delete = "DELETE FROM updates WHERE id=".$_POST["id"];
  13.     $query = mysql_query($delete);
  14.     if ($query == true) {
  15.         echo "Erfolgreich gel&ouml;scht.";
  16.     } else {
  17.         echo "Fehler im System. Bitte versuche es sp&auml;ter noch einmal...";
  18.     }
  19. }
  20. ?>
  21. <html>
  22. <head>
  23. <title><?php include '../../include/title/name.php'; ?></title>
  24. <link rel='SHORTCUT ICON' href='../../img/itable.jpg'>
  25. </head>
  26. <body>
  27. <h1>Updates</h1>
  28. <hr />
  29. <table border="1">
  30. <tr>
  31. <h4><th>Startzeit:</th><th>Endzeit:</th><th>Text:</th><th>Dauer:</th><th>Ausgabe:</th><th>L&ouml;schen:</th></h4>
  32. </tr>
  33. <?php
  34. $abfrage = "SELECT id,time,endtime,text,dauer FROM updates ORDER BY time DESC";
  35. $ergebnis = mysql_query($abfrage);
  36. while($row = mysql_fetch_object($ergebnis)) {
  37.     echo "<tr>";
  38.     echo "<td>" . $row->time . "</td>";
  39.     echo "<td>" . $row->endtime . "</td>";
  40.     echo "<td>" . $row->text . "</td>";
  41.     echo "<td>" . $row->dauer . "</td>";
  42.     echo "<td></td>";
  43.     echo "<td>";
  44.     echo "<form action='' method='POST'>";
  45.     echo "<input type='hidden' name='id' value='" . $row->id . "'/>";
  46.     echo "<input type='submit' value='Benutzer l&ouml;schen'/></form>";
  47.     echo "</td>";
  48.     echo "</tr>";
  49. }
  50. ?>
  51. </table>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement