Re: Das neue Auswendig lernen und die neuen Übungen -

Image Screenshot_20240412_114020

<?php
session_start ();
?>

<form method="POST" action="./form20240412.php">
<input type="text" name="form20240412a"></input>
<input type="submit">
</form>

<?php
echo session_id (). "<br>n";

setcookie ("form20240412b", "Ich bin das erste Cookie" , time () + 1200);

echo htmlentities (\$_POST ["form20240412a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240412b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240412c"]) . "<br>n";

session_destroy ();
?>

POST http://localhost/mysql20240217/20240412/form20240412.php HTTP/1.1
host: localhost
Cookie: form20240412c=Hallo, dies ist das zweite Cookie
Content-Length: 59
Content-Type: application/x-www-form-urlencoded

form20240412a=Hallo, ich bin das Datum und zwar das einzige

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Fri, 12 Apr 2024 09:48:39 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=3h58lal0qr0ebjbt9nkppe4n95; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240412b=Ich%20bin%20das%20erste%20Cookie; expires=Fri, 12 Apr 2024 10:08:39 GMT; Max-Age=1200
Vary: Accept-Encoding
Content-Length: 254
Content-Type: text/html; charset=UTF-8


<form method="POST" action="./form20240412.php">
<input type="text" name="form20240412a"></input>
<input type="submit">
</form>

3h58lal0qr0ebjbt9nkppe4n95<br>
Hallo, ich bin das Datum und zwar das einzige<br>
<br>
Hallo, dies ist das zweite Cookie<br>

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE mysql20240412" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE mysql20240412" . 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); INSERT INTO a (x1, x2) VALUES (0, 1); INSERT INTO a (x1, x2) VALUES (1, 0); INSERT INTO a (x1, x2) VALUES (1, 1); INSERT INTO a (x2, x1) VALUES (7, 2); INSERT INTO b (y1, y2) VALUES (0, 0); INSERT INTO b (y1, y2) VALUES (1, 1); 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 mysql20240412" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

0, 0; 0, 1; 1, 0; 1, 1; 2, 7; <br>
0, 0; 1, 1; 2, 7; <br>
0, 0, 0, 0; 0, 1, 0, 0; 1, 0, 1, 1; 1, 1, 1, 1; 2, 7, 2, 7; <br>

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE q20240412" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE q20240412" . 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 < 24;  \$i++) {
    \$sql = "INSERT INTO a (x) VALUES (" . rand () % 28 . "); ";
    \$sql .= "INSERT INTO b (x) VALUES (" . rand () % 32 . "); ";
    \$sql .= "INSERT INTO c (x) VALUES (" . rand () % 64 . "); ";
    \$db->query (\$sql);
}

\$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 ORDER BY 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 b INTERSECT SELECT x FROM c) x
    ) x ORDER BY 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 ORDER BY 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 ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "DROP DATABASE q20240412" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

0, 1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 21, 23, 24, 25, 27, 29, 31, <br>
0, 2, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 29, 31, 33, 39, 40, 42, 48, 56, 57, <br>
0, 1, 3, 4, 6, 7, 8, 12, 14, 16, 18, 20, 21, 23, 24, 25, 26, 28, 29, 31, 33, 39, 40, 42, 48, 56, 57, <br>
4, 6, 14, 16, 20, 21, 23, 24, 25, <br>
0, 14, 20, 23, <br>
7, 14, 18, 20, 23, 29, 31, <br>
0, 7, 14, 18, 20, 23, 29, 31, <br>
0, 7, 14, 18, 20, 23, 29, 31, <br>
4, 6, 7, 14, 16, 18, 20, 21, 23, 24, 25, 29, 31, <br>
4, 6, 7, 14, 16, 18, 20, 21, 23, 24, 25, 29, 31, <br>
0, 4, 6, 14, 16, 20, 21, 23, 24, 25, <br>
0, 4, 6, 14, 16, 20, 21, 23, 24, 25, <br>