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

Image 1nFTxITIzuULnuzkHAqUWUXnhZx5Li6si

<?php
session_start ();
?>

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

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

setcookie ("form20240518b", "Ich bin das erste Cookie", time () + 3600);

echo htmlentities (\$_POST ["form20240518a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240518b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240518c"]) . "<br>n";

session_destroy ();
?>

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Sat, 18 May 2024 08:27:23 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=itid7knvm50fg7f2vieql39rg0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240518b=Ich%20bin%20das%20erste%20Cookie; expires=Sat, 18 May 2024 09:27:23 GMT; Max-Age=3600
Vary: Accept-Encoding
Content-Length: 231
Content-Type: text/html; charset=UTF-8


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

itid7knvm50fg7f2vieql39rg0<br>
Ich bin das Datum<br>
<br>
Hallo, ich bin das zweite Keks<br>

-POST http://localhost/mysql20240217/20240518/form20240518.php HTTP/1.1
host: localhost
Cookie: form20240518c=Hallo, ich bin das zweite Keks
Content-Length: 31
Content-Type: application/x-www-form-urlencoded

form20240518a=Ich bin das Datum

<?php
session_start ();

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

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

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

\$sql = "USE q20240518" . 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 () % 32 . "); ";
    \$sql .= "INSERT INTO b (x) VALUES (" . rand () % 64 . "); ";
    \$sql .= "INSERT INTO c (x) VALUES (" . rand () % 128 . "); ";
    \$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
                INTERSECT
            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 a INTERSECT SELECT x FROM b) 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 q20240518" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

0; 1; 3; 4; 6; 7; 8; 11; 13; 14; 16; 17; 19; 21; 23; 24; 25; 28; 29; 31; 32; 39; 41; 49; 51; 53; 58; 62; <br>
0; 1; 2; 4; 6; 7; 8; 10; 12; 13; 14; 16; 19; 21; 24; 25; 29; 31; 37; 38; 39; 42; 44; 56; 60; 64; 67; 76; 80; 83; 92; 97; 99; 104; 111; 114; <br>
0; 1; 2; 3; 6; 7; 10; 11; 12; 16; 17; 19; 21; 23; 28; 32; 37; 38; 39; 41; 42; 44; 49; 51; 53; 56; 58; 60; 62; 64; 67; 76; 80; 83; 92; 97; 99; 104; 111; 114; <br>
0; 1; 6; 7; 16; 19; 21; <br>
21; <br>
21; 39; <br>
21; 39; <br>
21; 39; <br>
0; 1; 6; 7; 16; 19; 21; 39; <br>
21; <br>
0; 1; 6; 7; 16; 19; 21; <br>
0; 1; 6; 7; 16; 19; 21; <br>