Re: Die üblichen Übungen

<?php
session_start ();
?>

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

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

setcookie ("form2024030402", "Hallo, ich bin das erste Cookie", time () + 3600);

echo htmlentities (\$_COOKIE ["form2024030402"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form2024030403"]) . "<br>n";
echo htmlentities (\$_POST ["form2024030401"]) . "<br>n";

session_destroy ();
?>

Image Screenshot_20240304_174022

POST http://localhost/mysql20240217/20240304/form20240304.php HTTP/1.1
host: localhost
Cookie: form2024030403=Hallo, ich bin das zweite Cookie
Content-Length: 48
Content-Type: application/x-www-form-urlencoded

form2024030401=Hallo, ich bin das Datum Nummer 1

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Mon, 04 Mar 2024 16:47:13 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=bda0caq05ir2pocbdqqblpnc75; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form2024030402=Hallo%2C%20ich%20bin%20das%20erste%20Cookie; expires=Mon, 04 Mar 2024 17:47:13 GMT; Max-Age=3600
Vary: Accept-Encoding
Content-Length: 242
Content-Type: text/html; charset=UTF-8


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

bda0caq05ir2pocbdqqblpnc75<br>
<br>
Hallo, ich bin das zweite Cookie<br>
Hallo, ich bin das Datum Nummer 1<br>

<?php
session_start ();

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

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

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

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

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

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

\$sql = "INSERT INTO a (x1, x2) VALUES (2, 2); ";
\$db->query (\$sql);
\$sql = "INSERT INTO a (x1, x2) VALUES (2, 4); ";
\$db->query (\$sql);
\$sql = "INSERT INTO a (x1, x2) VALUES (4, 2); ";
\$db->query (\$sql);
\$sql = "INSERT INTO a (x1, x2) VALUES (4, 4); ";
\$db->query (\$sql);
\$sql = "INSERT INTO a (x1, x2) VALUES (8, 9); ";
\$db->query (\$sql);
\$sql = "INSERT INTO b (y1, y2) VALUES (2, 4); ";
\$db->query (\$sql);
\$sql = "INSERT INTO b (y1, y2) VALUES (4, 2); ";
\$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";
\$sql = "SELECT y1, y2 FROM b; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", " . \$row [1] . "<br>n";
echo "<br>n";
\$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", " . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "<br>n";
echo "<br>n";

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

session_destroy ();
?>

2, 2<br>
2, 4<br>
4, 2<br>
4, 4<br>
8, 9<br>
<br>
2, 4<br>
4, 2<br>
<br>
2, 2, 2, 4<br>
2, 2, 4, 2<br>
2, 4, 2, 4<br>
2, 4, 4, 2<br>
4, 2, 2, 4<br>
4, 2, 4, 2<br>
4, 4, 2, 4<br>
4, 4, 4, 2<br>
8, 9, 2, 4<br>
8, 9, 4, 2<br>
<br>

<?php
session_start ();

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

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

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

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

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

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

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

for (\$i = 0;  \$i < 24;   \$i++) {
    \$sql = "INSERT INTO a (x) VALUES ("" . rand () % 32 . ""); ";
    \$db->query (\$sql);
    \$sql = "INSERT INTO b (x) VALUES ("" . rand () % 64  . ""); ";
    \$db->query (\$sql);
    \$sql = "INSERT INTO c (x) VALUES (" " . rand () % 128 . ""); ";
}

\$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 UNION SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM c UNION 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 q20240304" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

8, 17, 22, 12, 29, 2, 4, 10, 5, 16, 24, 31, 28, 15, 0, 55, 46, 54, 56, 26, 36, 60, 52, 63, 9, 3, 35, 48, 44, 21, 40, <br>
8, 17, 22, 12, 29, 2, 4, 10, 5, 16, 24, 31, 28, 15, 0, <br>
55, 24, 46, 54, 56, 26, 36, 60, 52, 28, 63, 9, 10, 3, 35, 48, 44, 21, 15, 40, <br>
10, 24, 28, 15, <br>
<br>
<br>
<br>
<br>
10, 24, 28, 15, <br>
8, 17, 22, 12, 29, 2, 4, 10, 5, 16, 24, 31, 28, 15, 0, 55, 46, 54, 56, 26, 36, 60, 52, 63, 9, 3, 35, 48, 44, 21, 40, <br>
24, 28, 10, 15, <br>
24, 28, 10, 15, <br>

#!/bin/bash

if [[ "\$1" == "David" \&amp;\&amp; "\$2" == "Vajda" ]]
then
    echo "Das bin ich"
elif [[ "\$1" == "David Vajda" \&amp;\&amp; -z "\$2" ]]
then
    echo "Das bin ich"
elif [[ "\$1" == "David" \&amp;\&amp; -z "\$2" ]]
then
    echo "Das koennte ich sein"
elif [[ "\$1" == "Vajda" \&amp;\&amp; -z "\$2" ]]
then
    echo "Das koennte ich sein"
elif [ -n "\$1" ]
then
    echo "Das bin ich eher nicht"
else
    echo "Hallo Welt"
    i=0
    while [ \$i -lt 10 ]
    do
        echo "Hallo zum \$((\$i+1))."
        i=\$((\$i+1))
    done
    a=(Aber hallo das ist ein Array)
    a+=(Ja genau das)
    i=0
    while [ \$i -lt 9 ]
    do
        echo "\${a[\$i]}"
        i=\$((\$i+1))
    done
    for s in "\${a[@]}"
    do
        echo "\$s"
    done
    l=\$(ls)
    for s in \$l
    do
        echo "\$s"
    done
fi

/bin/bash myhello.sh "David" "Vajda"
/bin/bash myhello.sh "David Vajda"
/bin/bash myhello.sh "David"
/bin/bash myhello.sh "Vajda"
/bin/bash myhello.sh "Max Mustermann"
/bin/bash myhello.sh

Das bin ich
Das bin ich
Das koennte ich sein
Das koennte ich sein
Das bin ich eher nicht
Hallo Welt
Hallo zum 1.
Hallo zum 2.
Hallo zum 3.
Hallo zum 4.
Hallo zum 5.
Hallo zum 6.
Hallo zum 7.
Hallo zum 8.
Hallo zum 9.
Hallo zum 10.
Aber
hallo
das
ist
ein
Array
Ja
genau
das
Aber
hallo
das
ist
ein
Array
Ja
genau
das
myhellocmd.sh
myhello.out
myhello.sh

Image Screenshot_20240304_201747

 0 0 0 0 0    1
 1 0 0 0 1    1
 2 0 0 1 0    1
 3 0 0 1 1    1
 4 0 1 0 0    0
 5 0 1 0 1    0
 6 0 1 1 0    0
 7 0 1 1 1    1
 8 1 0 0 0    0
 9 1 0 0 1    0
10 1 0 1 0    1
11 1 0 1 1    0
12 1 1 0 0    0
13 1 1 0 1    1
14 1 1 1 0    1
15 1 1 1 1    1


 0 0 0 0 0    1
 1 0 0 0 1    1
 2 0 0 1 0    1
 3 0 0 1 1    1
 7 0 1 1 1    1
10 1 0 1 0    1
13 1 1 0 1    1
14 1 1 1 0    1
15 1 1 1 1    1


Gruppe 0:
 0 0 0 0 0    1
Gruppe 1:
 1 0 0 0 1    1
 2 0 0 1 0    1
Gruppe 2:
 3 0 0 1 1    1
10 1 0 1 0    1
Gruppe 3:
 7 0 1 1 1    1
13 1 1 0 1    1
14 1 1 1 0    1
Gruppe 4:
15 1 1 1 1    1


0:1         0 0 0 -
0:2         0 0 - 0
1:3         0 0 - 1
2:3         0 0 1 -
2:10        - 0 1 0
3:7         0 - 1 1
10:14       1 - 1 0
7:15        - 1 1 1
13:15       1 1 - 1
14:15       1 1 1 -


0:1         0 0 0 -
2:3         0 0 1 -
14:15       1 1 1 -
3:7         0 - 1 1
10:14       1 - 1 0
0:2         0 0 - 0
1:3         0 0 - 1
13:15       1 1 - 1
2:10        - 0 1 0
7:15        - 1 1 1



Gruppe 0:
0:1         0 0 0 -
Gruppe 1:
2:3         0 0 1 -
Gruppe 3:
14:15       1 1 1 -

Gruppe 2:
3:7         0 - 1 1
10:14       1 - 1 0

Gruppe 0:
0:2         0 0 - 0
Gruppe 1:
1:3         0 0 - 1
Gruppe 3:
13:15       1 1 - 1

Gruppe 1:
2:10        - 0 1 0
Gruppe 3:
7:15        - 1 1 1



Gruppe 0:
0:1         0 0 0 -
Gruppe 1:
2:3         0 0 1 -
Gruppe 3:
14:15       1 1 1 -

0:1:2:3         0 0 - -
14:15           1 1 1 -

Gruppe 2:
3:7             0 - 1 1
10:14           1 - 1 0

Gruppe 0:
0:2         0 0 - 0
Gruppe 1:
1:3         0 0 - 1
Gruppe 3:
13:15       1 1 - 1

0:2:1:3         0 0 - -
13:15           1 1 - 1

Gruppe 1:
2:10            - 0 1 0
Gruppe 3:
7:15            - 1 1 1





0:1:2:3         0 0 - -
14:15           1 1 1 -
3:7             0 - 1 1
10:14           1 - 1 0
0:2:1:3         0 0 - -
13:15           1 1 - 1
2:10            - 0 1 0
7:15            - 1 1 1




0:1:2:3         0 0 - -
14:15           1 1 1 -
3:7             0 - 1 1
10:14           1 - 1 0
13:15           1 1 - 1
2:10            - 0 1 0
7:15            - 1 1 1


            0   1   2   3   7   10  13  14  15
0:1:2:3     *   *   *   *
14:15                                   *   *
3:7                     *   *
10:14                           *       *
13:15                               *       *
2:10                *           *
7:15                        *               *



            0   1   2   3   7   10  13  14  15
0:1:2:3     *   *   *   *
14:15                                   *   *
3:7                     *   *
10:14                           *       *
13:15                               *       *


0:1:2:3         0 0 - -
14:15           1 1 1 -
3:7             0 - 1 1
10:14           1 - 1 0
13:15           1 1 - 1

    y <= (not x3 and not x2) or
            (x3 and x2 and x1) or
            (not x3 and x1 and x0) or
            (x3 and x1 and not x0) or
            (x3 and x2 and x0);
    y <= (
            (x3 or x2) and
            (not x3 and not x2 and not x1) and
            (x3 or not x1 or not x0) and
            (not x3 or not x1 or x0) and
            (not x3 or not x2 or not x0)
        );

library ieee;
use ieee.std_logic_1164.all;

entity quine220240304 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine220240304 is
begin
    y <= (not x3 and not x2) or
            (x3 and x2 and x1) or
            (not x3 and x1 and x0) or
            (x3 and x1 and not x0) or
            (x3 and x2 and x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine220240304testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine220240304testbench is
    component quine220240304
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine220240304 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);

library ieee;
use ieee.std_logic_1164.all;

entity quine20240304 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240304 is
begin
    y <= (not x3 and not x2) or
            (x3 and x2 and x1) or
            (not x3 and x1 and x0) or
            (x3 and x1 and not x0) or
            (x3 and x2 and x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240304testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240304testbench is
    component quine20240304
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240304 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);
    x0 <= '0' after 0 ns, '1' after 10 ns, '0' after 20 ns, '1' after 30 ns, '0' after 40 ns, '1' after 50 ns, '0' after 60 ns, '1' after 70 ns, '0' after 80 ns, '1' after 90 ns, '0' after 100 ns, '1' after 110 ns, '0' after 120 ns, '1' after 130 ns, '0' after 140 ns, '1' after 150 ns;

    x1 <= '0' after 0 ns, '0' after 10 ns, '1' after 20 ns, '1' after 30 ns, '0' after 40 ns, '0' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '1' after 100 ns, '1' after 110 ns, '0' after 120 ns, '0' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x2 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '1' after 40 ns, '1' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '0' after 100 ns, '0' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x3 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '0' after 40 ns, '0' after 50 ns, '0' after 60 ns, '0' after 70 ns, '1' after 80 ns, '1' after 90 ns, '1' after 100 ns, '1' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;
end;