This commit is contained in:
3p01
2025-10-23 08:43:51 +02:00
parent f8ec0df47f
commit e56b8ee782
6 changed files with 407 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
$text = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$dzien = $_POST['dzien'];
switch ($dzien) {
case 1:
$text = 'Poniedziałek';
break;
case 2:
$text = 'Wtorek';
break;
case 3:
$text = 'Środa';
break;
case 4:
$text = 'Czwartek';
break;
case 5:
$text = 'Piątek';
break;
case 6:
$text = 'Sobota';
break;
case 7:
$text = 'Niedziela';
break;
default:
$text = 'Podana liczba jest spoza zakresu!';
}
}
?>
<!doctype html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Z60 - Dzień tygodnia</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z60</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
<p>Napisz program, który dla podanej liczby całkowitej z przedziału od 1 do 7 wypisuje jaki to dzień tygodnia. Zakładamy, że 1 to poniedziałek. W przypadku liczby z poza zakresu należy wyświetlić informację o błędzie.</p>
</div>
<div class="box">
<form action="index.php" method="post">
<label for="dzien">Wprowadź liczbę od 1 do 7: </label><br>
<input type="number" name="dzien" id="dzien"><br>
<button type="submit">Wyślij</button>
</form>
</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
echo '<div class="box">' . $text . '</div>';
}
?>
</body>
</html>

View File

@@ -0,0 +1,68 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 15px;
font-size: 0.9em;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 10px 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
input {
margin-top: 5px;
margin-bottom: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
margin-top: 10px;
}
pre {
font-family: Verdana, serif;
}
.box {
border: 2px solid black;
padding: 15px 20px;
border-radius: 1em;
margin: 15px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
.box h3 {
cursor: pointer;
}
td {
width: 50px;
height: 50px;
margin: 0;
padding: 0;
}
tr {
padding: 0;
}
.y {
background: yellow;
}
.b {
background:blue;
}

View File

@@ -0,0 +1,59 @@
<?php
$text = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
$delta = $b * $b - 4 * $a * $c;
if ($delta < 0) {
$text = 'Równanie nie ma rozwiązanie';
} else if ($delta == 0) {
$x1 = -$b / (2 * $a);
$text = 'Równanie ma jedno rozwiązanie: x = ' . $x1;
} else if ($delta > 0) {
$x1 = (-$b + sqrt($delta)) / (2 * $a);
$x2 = (-$b - sqrt($delta)) / (2 * $a);
$text = 'Równanie ma dwa rozwiązania: x1 = ' . $x1 . ' i x2 = ' . $x2;
}
}
?>
<!doctype html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Z65 - Równanie kwadratowe</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z65</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
<p>Napisz program, który oblicza pierwiastki równania kwadratowego. Program dla danych A, B i C ma sprawdzać czy równanie jest kwadratowe, czy ma jeden czy dwa pierwiastki i czy ma rozwiązanie.</p>
</div>
<div class="box">
<form action="index.php" method="post">
<label for="a">Wprowadź A: </label><br>
<input type="number" name="a" id="a"><br>
<label for="b">Wprowadź B:</label><br>
<input type="number" name="b" id="b"><br>
<label for="c">Wprowadź C:</label><br>
<input type="number" name="c" id="c"><br>
<button type="submit">Wyślij</button>
</form>
</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
echo '<div class="box">' . "A: <b>$a</b><br>B: <b>$b</b><br>C: <b>$c</b><br> ";
echo "Postać równania: <b>$a * x<sup>2</sup> + $b * x + $c = 0</b><br>";
echo $text . '</div>';
}
?>
</body>
</html>

View File

@@ -0,0 +1,68 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 15px;
font-size: 0.9em;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 10px 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
input {
margin-top: 5px;
margin-bottom: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
margin-top: 10px;
}
pre {
font-family: Verdana, serif;
}
.box {
border: 2px solid black;
padding: 15px 20px;
border-radius: 1em;
margin: 15px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
.box h3 {
cursor: pointer;
}
td {
width: 50px;
height: 50px;
margin: 0;
padding: 0;
}
tr {
padding: 0;
}
.y {
background: yellow;
}
.b {
background:blue;
}

View File

@@ -0,0 +1,81 @@
<?php
$text = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$dzien1 = htmlspecialchars($_POST['dzien1']);
$miesiac1 = htmlspecialchars($_POST['miesiac1']);
$rok1 = htmlspecialchars($_POST['rok1']);
$dzien2 = htmlspecialchars($_POST['dzien2']);
$miesiac2 = htmlspecialchars($_POST['miesiac2']);
$rok2 = htmlspecialchars($_POST['rok2']);
$data1 = mktime(0, 0, 0, $miesiac1, $dzien1, $rok1);
$data2 = mktime(0, 0, 0, $miesiac2, $dzien2, $rok2);
$textData1 = date('d-m-Y', $data1);
$textData2 = date('d-m-Y', $data2);
if (!(checkdate($miesiac1, $dzien1, $rok1) && checkdate($miesiac2, $dzien2, $rok2))) {
$text = 'Jedna lub obie daty są niepoprawne';
} else {
if ($data1 < $data2) {
$text = "Pierwsza data ($textData1) jest wcześniejsza od drugiej ($textData2)";
} else if ($data1 > $data2) {
$text = "Druga data ($textData2) jest wcześniejsza od pierwszej ($textData1)";
}
}
}
?>
<!doctype html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Z66 - porównanie daty</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z66</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
<p>
Napisz program, który dla dat o postaci dzien1, miesiac1, rok1 oraz dzien2, miesiac2, rok2 określi, która z nich jest wcześniejsza. Program powinien przyjmować dane z formularza, weryfikować ich poprawność (np. czy dzień i miesiąc tworzą istniejącą datę) i wyświetlać obie daty oraz wynik porównania w czytelny sposób.
<br><br>
<b>Wskazówki dla ucznia:</b>
</p>
<ul>
<li>Użyj funkcji checkdate(), aby zweryfikować, czy data jest poprawna (np. czy 31-02-2023 istnieje).</li>
<li>Porównaj daty, zaczynając od roku, potem miesiąca, a na końcu dnia możesz to zrobić za pomocą prostych porównań (<, >, ==).</li>
<li>Alternatywnie, przekształć daty na znaczniki czasu za pomocą mktime() i porównaj je directly.</li>
<li>Zabezpiecz dane wejściowe za pomocą htmlspecialchars(), aby uniknąć problemów z XSS.</li>
<li>Wyświetl obie daty w formacie czytelnym, np. dzien-miesiac-rok, i poinformuj o błędach, jeśli dane są niepoprawne.</li>
</ul>
</div>
<div class="box">
<form action="index.php" method="post">
<fieldset>
<legend>Pierwsza data:</legend>
<label for="dzien1">Dzień: </label><br>
<input id="dzien1" name="dzien1" type="text"><br>
<label for="miesiac1">Miesiąc: </label><br>
<input id="miesiac1" name="miesiac1" type="text"><br>
<label for="rok1">Rok:</label><br>
<input id="rok1" name="rok1" type="text"><br>
</fieldset>
<br>
<fieldset>
<legend>Druga data:</legend>
<label for="dzien2">Dzień: </label><br>
<input id="dzien2" name="dzien2" type="text"><br>
<label for="miesiac2">Miesiąc: </label><br>
<input id="miesiac2" name="miesiac2" type="text"><br>
<label for="rok2">Rok:</label><br>
<input id="rok2" name="rok2" type="text"><br>
</fieldset>
<button type="submit">Wyślij</button>
</form>
</div>
<?php if ($text != '') { echo '<div class="box">' . $text . '</div>'; }?>
</body>
</html>

View File

@@ -0,0 +1,68 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 15px;
font-size: 0.9em;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 10px 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
input {
margin-top: 5px;
margin-bottom: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
margin-top: 10px;
}
pre {
font-family: Verdana, serif;
}
.box {
border: 2px solid black;
padding: 15px 20px;
border-radius: 1em;
margin: 15px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
.box h3 {
cursor: pointer;
}
td {
width: 50px;
height: 50px;
margin: 0;
padding: 0;
}
tr {
padding: 0;
}
.y {
background: yellow;
}
.b {
background:blue;
}