Konfiguracja Dockera i pierwsza lekcja

This commit is contained in:
floriano committed 2026-09-13 17:47:57 +02:00
1 parent 4086cfb140
commit 90de07cc43
8 files changed
+448

No files matched your search

+199
View File
@@ -0,0 +1,199 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GET, POST, if</title>
</head>
<body>
<h1>Pobieranie wartości z formularza, instrukcja warunkowa</h1>
<h2>1</h2>
<form action="./" method="post">
<input type="text" name="tekst1"><input type="submit" value="ok"><br>
<?= "wpisano: " . @$_POST['tekst1']?>
</form>
<h2>2</h2>
<form action="./wynik.php" method="post">
<h3>Ile masz lat</h3>
<input type="number" name="wiek" min="0" max="100" value="12">
<input type="submit" value="ok">
</form>
<h2>3</h2>
<form action="./" method="get">
<h3>Czy Impuls II to najlepszy EZT?</h3>
<select name="impuls">
<option value="t">tak</option>
<option value="n">nie</option>
</select>
<input type="submit" value="ok">
<?php
if(@$_GET['impuls'] == 't') {
echo '<p>Człowiek kultury.</p>';
} elseif(@$_GET['impuls'] == 'n') {
echo '<p>WTF?! Odpuszczę ci tylko gdy uważasz że Stadler FLIRT jest lepszy.</p>';
} else {
echo '<p>Hmmm?!</p>';
}
?>
</form>
<h2>4</h2>
<form action="./" method="post">
<input type="number" name="liczba1">
<select name="operacja">
<option><</option>
<option><=</option>
<option>=</option>
<option>>=</option>
<option>></option>
</select>
<input type="number" name="liczba2">
? <input type="submit" value="ok">
</form>
<?php
switch (@$_POST['operacja']) {
case '<':
if(@$_POST['liczba1'] < @$_POST['liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '<=':
if(@$_POST['liczba1'] <= @$_POST['liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '=':
if(@$_POST['liczba1'] == @$_POST['liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '>=':
if(@$_POST['liczba1'] >= @$_POST['liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '>':
if(@$_POST['liczba1'] > @$_POST['liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
}
?>
<h2>5</h2>
<form action="./" method="post">
<input type="number" name="_liczba1">
<select name="_operacja">
<option><</option>
<option><=</option>
<option>=</option>
<option>>=</option>
<option>></option>
</select>
<input type="number" name="_liczba2">
? <input type="image" alt="ok" width="40px" src="https://img.freepik.com/premium-wektory/znak-ok-z-ikona-symbolu-reki_423491-228.jpg?semt=ais_hybrid&w=740&q=80">
</form>
<?php
switch (@$_POST['_operacja']) {
case '<':
if(@$_POST['_liczba1'] < @$_POST['_liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '<=':
if(@$_POST['_liczba1'] <= @$_POST['_liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '=':
if(@$_POST['_liczba1'] == @$_POST['_liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '>=':
if(@$_POST['_liczba1'] >= @$_POST['_liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
case '>':
if(@$_POST['_liczba1'] > @$_POST['_liczba2']) {
echo "<p>TAK</p>";
} else {
echo "<p>NIE</p>";
}
break;
}
?>
<h2>6</h2>
<form action="./" method="post">
<h3>Wpisz współczynniki równania kwadratowego</h3>
<input type="number" name="a">x<sup>2</sup>+
<input type="number" name="b">x+
<input type="number" name="c">=0
<input type="submit" value="oblicz pierwiastki">
</form>
<?php
if(isset($_POST['a']) && isset($_POST['b']) && isset($_POST['c'])) {
$delta=($_POST['b'] ** 2) - (4 * $_POST['a'] * $_POST['c']);
echo "delta=$delta<br>";
if($delta < 0) {
echo "brak pierwiastkow";
} elseif($delta == 0) {
$x0=(-$_POST['b'])/(2*$_POST['a']);
echo "x<sub>0</sub>=$x0";
} else {
$x1=(-$_POST['b']-sqrt($delta))/(2*$_POST['a']);
$x2=(-$_POST['b']+sqrt($delta))/(2*$_POST['a']);
echo "x<sub>1</sub>=$x1<br>x<sub>2</sub>=$x2";
}
}
?>
<h2>7</h2>
<form action="./" method="post">
<h3>Wpisz współczynniki równania kwadratowego</h3>
<input type="number" name="_a">x<sup>2</sup>+
<input type="number" name="_b">x+
<input type="number" name="_c">=0
<input type="submit" value="oblicz pierwiastki"><br><br>
</form>
<?php
if(isset($_POST['_a']) && isset($_POST['_b']) && isset($_POST['_c'])) {
$delta=($_POST['_b'] ** 2) - (4 * $_POST['_a'] * $_POST['_c']);
echo "&Delta;=<input style='color: red;' size=1 disabled value='$delta'> ";
if($delta < 0) {
echo "brak pierwiastkow";
} elseif($delta == 0) {
$x0=(-$_POST['_b'])/(2*$_POST['_a']);
echo "x<sub>0</sub>=<input style='color: green;' disabled value='$x0'>";
} else {
$x1=(-$_POST['_b']-sqrt($delta))/(2*$_POST['_a']);
$x2=(-$_POST['_b']+sqrt($delta))/(2*$_POST['_a']);
echo "x<sub>1</sub>=<input style='color: green;' disabled value='$x1'> x<sub>2</sub>=<input style='color: green;' disabled value='$x2'>";
}
}
?>
</body>
</html>
+224
View File
@@ -0,0 +1,224 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pętle</title>
<style>
table, td {
border: 1px solid black;
}
.noborder {
border: none;
}
.noborder td {
border: none;
}
th {
background-color: gray;
}
</style>
</head>
<body>
<h1>Pętle</h1>
<h2>1</h2>
<form action="./petle.php" method="post">
<p>Ile cyfr wypisać</p>
<input type="number" name="ile1">
<input type="submit" value="ok">
</form>
<?php
$i = 1;
while($i <= @$_POST['ile1']) {
echo $i . " ";
$i++;
}
?>
<h2>2</h2>
<form action="./petle.php" method="post">
<p>Ile cyfr wypisać</p>
<input type="number" name="ile2">
<input type="submit" value="ok">
</form>
<?php
if(isset($_POST['ile2'])) {
$i = 1;
do {
echo $i . "<br>";
} while (++$i <= $_POST['ile2']);
}
?>
<h2>3</h2>
<form action="./petle.php" method="post">
<p>Schodzimy do zera. Od ilu?</p>
<input type="number" name="ile3">
<input type="submit" value="ok">
</form>
<?php
for($i = @$_POST['ile3']; $i > 0; $i--) {
echo $i . " ";
}
?>
<h2>4</h2>
<form action="./petle.php" method="post">
<label for="start">start:</label>
<input type="number" name="start" id="start" size=1>
<label for="krok">krok:</label>
<input type="number" name="krok" id="krok" size=1>
<label for="koniec">koniec:</label>
<input type="number" name="koniec" id="koniec" size=1>
<input type="submit" value="ok">
</form>
<?php
if(isset($_POST['start']) && isset($_POST['krok']) && isset($_POST['koniec'])) {
if(intval($_POST['krok']) != 0) {
if ((($_POST['start'] <= $_POST['koniec']) && ($_POST['krok'] > 0)) || (($_POST['start'] >= $_POST['koniec']) && ($_POST['krok'] < 0))) {
for($i = intval($_POST['start']); $i <= intval($_POST['koniec']); $i += intval($_POST['krok'])) {
echo $i . " ";
}
} else {
echo "Nie wykonam nieskończonej pętli!";
}
} else {
echo "Nie wykonam nieskończonej pętli!";
}
}
?>
<h2>5</h2>
<form action="./wynik.php" method="post">
<p>Ile masz lat?</p>
<select name="wiek">
<?php
for($i = 1; $i < 134; $i++) {
echo "<option>$i</option>";
}
?>
</select>
<input type="submit" value="ok">
</form>
<h2>6</h2>
<form action="./petle.php" method="get">
<p>Ile cyfr:</p>
<input type="number" name="ile">
<p>Kierunek:</p>
<select name="kierunek">
<option>Poziom</option>
<option>Pion</option>
</select>
<p>Krok:</p>
<input type="number" name="krok">
<input type="submit" value="ok"><br><br>
</form>
<table>
<?php
for($i = 0; $i < @$_GET['ile']; $i++) {
if(@$_GET['kierunek'] == 'Pion') {
echo "<tr>";
}
echo '<td>' . $i * @$_GET['krok'] + 1 . '</td>';
if(@$_GET['kierunek'] == 'Pion') {
echo "</tr>";
}
}
?>
</table>
<h2>7</h2>
<form action="./petle.php" method="post">
Wierszy: <input type="number" name="wiersze">
Kolumn: <input type="number" name="kolumny">
<input type="submit" value="ok">
</form>
<table>
<?php
for($i = 0; $i < @$_POST['wiersze']; $i++) {
echo "<tr>";
for($j = 0; $j < @$_POST['kolumny']; $j++) {
echo '<td>' . ($i * @$_POST['kolumny']) + $j + 1 . '</td>';
}
echo "</tr>";
}
?>
</table>
<h2>8</h2>
<form action="./petle.php" method="post">
SZACHOWNICA:
Wierszy: <input type="number" name="szachownica_wiersze">
Kolumn: <input type="number" name="szachownica_kolumny">
<input type="submit" value="ok">
</form>
<table>
<?php
for($i = 0; $i < @$_POST['szachownica_wiersze']; $i++) {
$black = false;
if($i % 2 != 0) {
$black = true;
}
echo '<tr>';
for($j = 0; $j < @$_POST['szachownica_kolumny']; $j++) {
echo '<td style="width: 16px; height: 16px; ';
if($black) {
echo 'background-color: black;';
}
echo '"></td>';
$black = !$black;
}
echo '</tr>';
}
?>
</table>
<h2>9</h2>
<form action="./petle.php" method="get">
Rozmiar: <input type="number" name="tsize">
<input type="submit" value="ok">
</form>
<table>
<?php
for($i = 0; $i < @$_GET['tsize']; $i++) {
echo '<tr>';
for($j = 0; $j < @$_GET['tsize']; $j++) {
echo '<td>' . ($i + 1) * ($j + 1) . '</td>';
}
echo '</tr>';
}
?>
</table>
<h2>10</h2>
<form action="./petle.php" method="get">
Rozmiar: <input type="number" name="tsize2">
<input type="submit" value="ok">
</form>
<table class="noborder">
<?php
echo '<tr><td></td>';
for($i = 0; $i < @$_GET['tsize2']; $i++) {
echo '<th>' . $i+1 . '</th>';
}
echo '</tr>';
for($i = 0; $i < @$_GET['tsize2']; $i++) {
echo '<tr>';
echo '<th>' . $i+1 . '</th>';
for($j = 0; $j < @$_GET['tsize2']; $j++) {
echo '<td>' . ($i+1) * ($j+1) . '</td>';
}
echo '</tr>';
}
?>
</table>
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<?php
if(@$_POST['wiek'] < 12) {
echo "WTF?!";
} elseif(@$_POST['wiek'] > 12) {
echo "Stary człowiek a może";
} else {
echo "Jestem wojtek też mam 12 lat";
}
?>