Re: Das neue Auswendig lernen und die neuen UEbungen -

<!-- OK, fangen wir an -->

<?php
session_start ();
?>

<?php

session_destroy ();
?>

<?php
session_start ();
?>

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

<?php

session_destroy ();
?>

<?php
session_start ();
?>

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

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

setcookie ("form20240611b", "Hallo Welt (a)", time () + 120);

echo htmlentities (\$_POST ["form20240611a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240611b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240611c"]) . "<br>n";

session_destroy ();
?>

Image 1iN6jagz33jNKRrP1kt77QUjnJCFpXUmY

POST http://localhost/davidd/form20240611.php HTTP/1.1
host: localhost
Cookie: form20240611c=Hallo Welt (c)
Content-Length: 28
Content-Type: application/x-www-form-urlencoded

form20240611a=Hallo Welt (a)

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Tue, 11 Jun 2024 10:26:47 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=3fcj8c7f41kta41frtbrsdg1av; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240611b=Hallo%20Welt%20%28a%29; expires=Tue, 11 Jun 2024 10:28:47 GMT; Max-Age=120
Vary: Accept-Encoding
Content-Length: 212
Content-Type: text/html; charset=UTF-8

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

3fcj8c7f41kta41frtbrsdg1av<br>
Hallo Welt (a)<br>
<br>
Hallo Welt (c)<br>

<?php
session_start ();

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

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

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

\$sql = "USE q20240611" . session_id () . "; ";
\$db->query (\$sql);

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

session_destroy ();
?>

<?php
session_start ();

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

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

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

\$sql = "USE q20240611" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "";
\$sql .= "CREATE TABLE a (x1 INTEGER, x2 INTEGER); ";
\$sql .= "CREATE TABLE b (y1 INTEGER, y2 INTEGER); ";
\$db->query (\$sql);

\$sql = "";
\$sql .= "INSERT INTO a (x1, x2) VALUES (666, 666); ";
\$sql .= "INSERT INTO a (x1, x2) VALUES (555, 666); ";
\$sql .= "INSERT INTO a (x1, x2) VALUES (666, 555); ";
\$sql .= "INSERT INTO a (x1, x2) VALUES (555, 555); ";
\$sql .= "INSERT INTO a (x1, x2) VALUES (121, 121); ";
\$sql .= "INSERT INTO b (y1, y2) VALUES (666, 555); ";
\$sql .= "INSERT INTO b (y1, y2) VALUES (555, 666); ";
\$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 LEFT JOIN b ON a.x1 = b.y2; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", " . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "; ";
echo "<br>n";

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

session_destroy ();
?>

666, 666; 555, 666; 666, 555; 555, 555; 121, 121; <br>
666, 555; 555, 666; <br>
555, 666, 666, 555; 555, 555, 666, 555; 666, 666, 555, 666; 666, 555, 555, 666; 121, 121, , ; <br>

<?php
session_start ();

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

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

\$sql = "USE test; ";
\$db->query (\$sql);

\$a = "a_" . session_id ();
\$b = "b_" . session_id ();
\$c = "c_" . session_id ();

\$sql = "";
\$sql .= "CREATE TABLE " . \$a . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$b . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$c . " (x INTEGER); ";
\$db->query (\$sql);

session_destroy ();
?>

<?php
session_start ();

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

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

\$sql = "USE test; ";
\$db->query (\$sql);

\$a = "a_" . session_id ();
\$b = "b_" . session_id ();
\$c = "c_" . session_id ();

\$sql = "";
\$sql .= "CREATE TABLE " . \$a . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$b . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$c . " (x INTEGER); ";
\$db->query (\$sql);

for (\$i = 0;  \$i < 24;  \$i++) {
    \$sql = "";
    \$sql .= "INSERT INTO " . \$a . " VALUES (" . rand () % 032 . "); ";
    \$sql .= "INSERT INTO " . \$b . " VALUES (" . rand () % 064 . "); ";
    \$sql .= "INSERT INTO " . \$c . " VALUES (" . rand () % 128 . "); ";
    \$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 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 " . \$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";

session_destroy ();
?>

<?php
session_start ();

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

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

\$sql = "USE test; ";
\$db->query (\$sql);

\$a = "a_" . session_id ();
\$b = "b_" . session_id ();
\$c = "c_" . session_id ();

\$sql = "";
\$sql .= "CREATE TABLE " . \$a . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$b . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$c . " (x INTEGER); ";
\$db->query (\$sql);

for (\$i = 0;  \$i < 24;  \$i++) {
    \$sql = "";
    \$sql .= "INSERT INTO " . \$a . " VALUES (" . rand () % 032 . "); ";
    \$sql .= "INSERT INTO " . \$b . " VALUES (" . rand () % 064 . "); ";
    \$sql .= "INSERT INTO " . \$c . " VALUES (" . rand () % 128 . "); ";
    \$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 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 " . \$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";

session_destroy ();
?>

[code]
<?php
session_start ();

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

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

\$sql = "USE test; ";
\$db->query (\$sql);

\$a = "a_" . session_id ();
\$b = "b_" . session_id ();
\$c = "c_" . session_id ();

\$sql = "";
\$sql .= "CREATE TABLE " . \$a . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$b . " (x INTEGER); ";
\$sql .= "CREATE TABLE " . \$c . " (x INTEGER); ";
\$db->query (\$sql);

for (\$i = 0;  \$i < 24;  \$i++) {
    \$sql = "";
    \$sql .= "INSERT INTO " . \$a . " VALUES (" . rand () % 032 . "); ";
    \$sql .= "INSERT INTO " . \$b . " VALUES (" . rand () % 064 . "); ";
    \$sql .= "INSERT INTO " . \$c . " VALUES (" . rand () % 128 . "); ";
    \$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 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 " . \$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";

session_destroy ();
?>

8, 1, 4, 10, 5, 22, 14, 24, 0, 17, 15, 21, 16, 40, 39, 48, 2, 26, 34, 33, 47, 31, 9, 35, 12, <br>
8, 1, 4, 10, 5, 22, 14, 24, 0, 17, 15, 21, 16, 62, 54, 73, 25, 126, 107, 111, 112, 27, 104, 52, 94, 29, 78, 98, 91, 53, <br>
40, 4, 0, 16, 10, 39, 5, 48, 2, 26, 34, 33, 47, 31, 9, 21, 24, 35, 12, 62, 54, 73, 25, 126, 107, 111, 112, 27, 104, 52, 22, 94, 29, 1, 78, 98, 91, 53, <br>
4, 10, 5, 24, 0, 21, 16, <br>
1, 22, 24, 21, <br>
21, 24, <br>
1, 21, 22, 24, <br>
1, 21, 22, 24, <br>
0, 4, 5, 10, 16, 21, 24, <br>
0, 4, 5, 10, 16, 21, 24, <br>
0, 1, 4, 5, 10, 16, 21, 22, 24, <br>
0, 1, 4, 5, 10, 16, 21, 22, 24, <br>

Image 1FQdx2KI2K0meRJUX-heM3OYS1ADoA7b9