Code: Alles auswählen
<?php
session_start ();
?>
<form method="POST" action="./form20240315.php">
<input type="text" name="form20240315a"></form>
<input type="submit"></submit>
</form>
<?php
echo session_id () . "<br>\n";
setcookie ("form20240315b", "Ich bin das erste Cookie", time () + 3600);
echo htmlentities ($_POST ["form20240315a"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20240315b"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20240315c"]) . "<br>\n";
session_destroy ();
?>
![Bild](https://www.ituenix.de/nextcloud/data/dave/files/Documents/david4/2024-03-15/Screenshot_20240315_173009.png)
Code: Alles auswählen
POST http://localhost/mysql20240217/20240315/form20240315.php HTTP/1.1
host: localhost
Cookie: form20240315c=Hallo, das ist das zweite Cookie
Content-Length: 38
Content-Type: application/x-www-form-urlencoded
form20240315a=Hallo dies ist das Datum
Code: Alles auswählen
Trying ::1...
Connected to localhost.
Escape character is '^]'.
HTTP/1.1 200 OK
Date: Fri, 15 Mar 2024 16:34:41 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=6i374cokt5gevun1o59uof7n44; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240315b=Ich%20bin%20das%20erste%20Cookie; expires=Fri, 15 Mar 2024 17:34:41 GMT; Max-Age=3600
Vary: Accept-Encoding
Content-Length: 240
Content-Type: text/html; charset=UTF-8
<form method="POST" action="./form20240315.php">
<input type="text" name="form20240315a"></form>
<input type="submit"></submit>
</form>
6i374cokt5gevun1o59uof7n44<br>
Hallo dies ist das Datum<br>
<br>
Hallo, das ist das zweite Cookie<br>
Code: Alles auswählen
<?php
session_start ();
include ("/home/david/mysqldata.php");
$db = new PDO ("mysql: host=localhost", $MYSQL_USER, $MYSQL_PASSWORD);
$sql = "CREATE DATABASE mysql20240315" . session_id () . "; ";
$db->query ($sql);
$sql = "USE mysql20240315" . session_id () . "; ";
$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); ";
$db->query ($sql);
$sql = "INSERT INTO a (x1, x2) VALUES (0, 1); ";
$db->query ($sql);
$sql = "INSERT INTO a (x1, x2) VALUES (1, 0); ";
$db->query ($sql);
$sql = "INSERT INTO a (x1, x2) VALUES (1, 1); ";
$db->query ($sql);
$sql = "INSERT INTO a (x1, x2) VALUES (2, 7); ";
$db->query ($sql);
$sql = "INSERT INTO b (y1, y2) VALUES (0, 1); ";
$db->query ($sql);
$sql = "INSERT INTO b (y1, y2) VALUES (1, 0); ";
$db->query ($sql);
$sql = "INSERT INTO b (y1, y2) VALUES (2, 7); ";
$db->query ($sql);
$sql = "SELECT x1, x2 FROM a; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", " . $row [1] . ", ";
echo "<br>\n";
$sql = "SELECT y1, y2 FROM b; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", " . $row [1] . ", ";
echo "<br>\n";
$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x1 = b.y1; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", " . $row [1] . ", " . $row [2] . ", " . $row [3] . ", ";
echo "<br>\n";
$sql = "DROP DATABASE mysql20240315" . session_id () . "; ";
$db->query ($sql);
session_destroy ();
?>
Code: Alles auswählen
0, 0, 0, 1, 1, 0, 1, 1, 2, 7, <br>
0, 1, 1, 0, 2, 7, <br>
0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 2, 7, 2, 7, <br>
Code: Alles auswählen
<?php
session_start ();
include ("/home/david/mysqldata.php");
$db = new PDO ("mysql: host=localhost", $MYSQL_USER, $MYSQL_PASSWORD);
$sql = "CREATE DATABASE q20240315" . session_id () . "; ";
$db->query ($sql);
$sql = "USE q20240315" . session_id () . "; ";
$db->query ($sql);
$sql = "CREATE TABLE a (x INTEGER); CREATE TABLE b (x INTEGER); CREATE TABLE c (x INTEGER); ";
$db->query ($sql);
for ($i = 0; $i < 18; $i++) {
$sql = "INSERT INTO a (x) VALUES (\"" . rand () % 24 . "\"); ";
$sql .= "INSERT INTO b (x) VALUES (\"" . rand () % 32 . "\"); ";
$sql .= "INSERT INTO c (x) VALUES (\"" . rand () % 48 . "\"); ";
$db->query ($sql);
}
$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x
INTERSECT
SELECT x FROM c
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x
UNION
SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x
INTERSECT
SELECT x FROM b
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
UNION
SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM b) x
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x
INTERSECT
SELECT x FROM a
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "SELECT x FROM (
SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM a) x
UNION
SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM a) x
) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
echo $row [0] . ", ";
echo ";<br>\n";
$sql = "DROP DATABASE q20240315" . session_id () . "; ";
$db->query ($sql);
session_destroy ();
?>
Code: Alles auswählen
1, 10, 8, 9, 15, 16, 14, 12, 0, 2, 22, 3, 5, 6, 31, 20, 29, 25, 13, 17, ;<br>
1, 10, 8, 9, 15, 16, 14, 12, 0, 2, 22, 3, 26, 25, 38, 37, 41, 13, 5, 17, 19, 39, 46, 44, 34, ;<br>
5, 6, 22, 31, 15, 20, 2, 9, 14, 29, 25, 13, 17, 8, 26, 38, 37, 41, 19, 39, 46, 44, 34, ;<br>
8, 9, 15, 14, 2, 22, ;<br>
9, 15, 2, ;<br>
5, 15, 2, 9, 25, 13, 17, ;<br>
9, 15, 2, 5, 25, 13, 17, ;<br>
9, 15, 2, 5, 25, 13, 17, ;<br>
8, 9, 15, 14, 2, 22, 25, 13, 5, 17, ;<br>
8, 9, 15, 14, 2, 22, 25, 13, 5, 17, ;<br>
22, 15, 2, 9, 14, 8, ;<br>
22, 15, 2, 9, 14, 8, ;<br>