\begin{verbatim} POST http://localhost/david/20241109/form20241109.php HTTP/1.1 host: localhost Cookie: form20241109003=Ich bin das zweite Keks Content-Length: 43 Content-Type: application/x-www-form-urlencoded form20241109001=Ich bin das Date fuer heute
Trying ::1... Connected to localhost. Escape character is '^]'. HTTP/1.1 200 OK Date: Sat, 09 Nov 2024 07:13:09 GMT Server: Apache/2.4.62 (Debian) Set-Cookie: PHPSESSID=aooagsmr92b5s71gfvus85cvh5; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Set-Cookie: form20241109002=dies%20ist%20das%20erste%20Keks; expires=Sat, 09 Nov 2024 07:46:29 GMT; Max-Age=2000 Vary: Accept-Encoding Content-Length: 228 Content-Type: text/html; charset=UTF-8 <form method="POST" action="./form20241109.php"> <input type="text" name="form20241109001"></input> <input type="submit"> </form> aooagsmr92b5s71gfvus85cvh5<br> Ich bin das Date fuer heute<br> <br> Ich bin das zweite Keks<br>
<?php session_start (); ?> <form method="POST" action="./form20241109.php"> <input type="text" name="form20241109001"></input> <input type="submit"> </form> <?php echo session_id () . "<br>\n"; setcookie ("form20241109002", "dies ist das erste Keks", time () + 2000); echo htmlentities ($_POST ["form20241109001"]) . "<br>\n"; echo htmlentities ($_COOKIE ["form20241109002"]) . "<br>\n"; echo htmlentities ($_COOKIE ["form20241109003"]) . "<br>\n"; session_destroy (); ?>
<?php session_start (); include ("/home/david/MySQLTEST.php"); $db = new PDO ("mysql: host=localhost", $db_user, $db_password); $sql = "CREATE DATABASE MySQL20241109; "; $db->query ($sql); try { $sql = "USE MySQL20241109; "; $db->query ($sql); $sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); "; $db->query ($sql); $sql = "INSERT INTO a (x1, x2) VALUES (0, 0); "; $sql .= "INSERT INTO a (x1, x2) VALUES (0, 1); "; $sql .= "INSERT INTO a (x1, x2) VALUES (1, 0); "; $sql .= "INSERT INTO a (x1, x2) VALUES (1, 1); "; $sql .= "INSERT INTO a (x1, x2) VALUES (2, 7); "; $sql .= "INSERT INTO b (x1, x2) VALUES (0, 1); "; $sql .= "INSERT INTO b (x1, x2) VALUES (1, 0); "; $db -> query ($sql); $sql = "SELECT x1, x2 FROM a; "; $stmt = $db->query ($sql); while ($row = $stmt -> fetch ()) echo $row [0] . ", " . $row [1] . "<br>\n"; echo "<br>\n\n"; $sql = "SELECT y1, y2 FROM b; "; $stmt = $db->query ($sql); while ($row = $stmt -> fetch ()) echo $row [0] . ", " . $row [1] . "<br>\n"; echo "<br>\n\n"; $sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b WHERE a.x1 = b.y1; "; $stmt = $db->query ($sql); while ($row = $stmt -> fetch ()) echo $row [0] . ", " . $row [1] . ", " . $row [2] . ", " . $row [3] . "<br>\n"; echo "<br>\n\n"; $sql = "DROP DATABASE MySQL20241109; "; $db->query ($sql); } catch (Exception $e) { $sql = "DROP DATABASE MySQL20241109; "; $db->query ($sql); } session_destroy (); ?>
0, 0<br> 0, 1<br> 1, 0<br> 1, 1<br> 2, 7<br> <br> <br> <br>