Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="de">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <center><strong>Mein Gästebuch</strong><br /><br />
- <table>
- <tr>
- <td>
- <?php
- #var_dump($_GET);
- $login = $_GET['login'];
- $passwort = $_GET['pass'];
- if ($login=="admin" AND $pass==test){
- echo "Hello Admin";
- }
- $pdo = new PDO('mysql:host=localhost;dbname=gaestebuch', 'root', '');
- if(!empty($_GET['name']) AND !empty($_GET['beitrag'])){
- $name = $_GET['name'];
- $text = $_GET['beitrag'];
- $eintrag = "INSERT INTO eintraege (name, eintrag, datum) VALUES ('$name', '$text', NOW());";
- $pdo->query($eintrag);
- }
- #var_dump($pdo->errorInfo());
- $sql = "SELECT * FROM eintraege";
- $gefundene_eintraege = $pdo->query($sql);
- foreach ($gefundene_eintraege as $row) {
- echo $row['name']." ".$row['datum']."<br />";
- echo $row['eintrag']."<br /><br />";
- }
- ?>
- </td>
- </tr>
- </table>
- <form action="gaestebuch.php">
- <label for="name">Name</label>
- <input id="name"name="name">
- <label for="beitrag">Text</label>
- <input id="beitrag"name="beitrag">
- <button type="submit">Eintragen</button>
- </center>
- <form action="gaestebuch.php">
- <dl>
- <dt>
- <label for="login">Benutzer</label>
- </dt>
- <dd>
- <input id="login" name="login">
- </dd>
- <dt>
- <label for="pass">Passwort</label>
- </dt>
- <dd>
- <input id="pass" name="pass" type="password">
- </dd>
- <dd>
- <button>Anmelden</button>
- </dd>
- </dl>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement