Advertisement
Guest User

test

a guest
Mar 30th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="de">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. </head>
  7. <body>
  8. <center><strong>Mein Gästebuch</strong><br /><br />
  9. <table>
  10. <tr>
  11. <td>
  12. <?php
  13. #var_dump($_GET);
  14. $login = $_GET['login'];
  15. $passwort = $_GET['pass'];
  16.  
  17. if ($login=="admin" AND $pass==test){
  18. echo "Hello Admin";
  19. }
  20. $pdo = new PDO('mysql:host=localhost;dbname=gaestebuch', 'root', '');
  21. if(!empty($_GET['name']) AND !empty($_GET['beitrag'])){
  22. $name = $_GET['name'];
  23. $text = $_GET['beitrag'];
  24. $eintrag = "INSERT INTO eintraege (name, eintrag, datum) VALUES ('$name', '$text', NOW());";
  25. $pdo->query($eintrag);
  26. }
  27. #var_dump($pdo->errorInfo());
  28.  
  29. $sql = "SELECT * FROM eintraege";
  30. $gefundene_eintraege = $pdo->query($sql);
  31. foreach ($gefundene_eintraege as $row) {
  32. echo $row['name']." ".$row['datum']."<br />";
  33. echo $row['eintrag']."<br /><br />";
  34. }
  35. ?>
  36. </td>
  37. </tr>
  38. </table>
  39. <form action="gaestebuch.php">
  40. <label for="name">Name</label>
  41. <input id="name"name="name">
  42. <label for="beitrag">Text</label>
  43. <input id="beitrag"name="beitrag">
  44. <button type="submit">Eintragen</button>
  45. </center>
  46. <form action="gaestebuch.php">
  47. <dl>
  48. <dt>
  49. <label for="login">Benutzer</label>
  50. </dt>
  51. <dd>
  52. <input id="login" name="login">
  53. </dd>
  54. <dt>
  55. <label for="pass">Passwort</label>
  56. </dt>
  57. <dd>
  58. <input id="pass" name="pass" type="password">
  59. </dd>
  60. <dd>
  61. <button>Anmelden</button>
  62. </dd>
  63. </dl>
  64. </form>
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement