42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
||
?>
|
||
<!doctype html>
|
||
<html lang="pl">
|
||
<head>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||
<meta charset="UTF-8">
|
||
<title>Z40 - Jagoda</title>
|
||
<link rel="stylesheet" href="style.css">
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<h1>Zadanie Z40</h1>
|
||
<h2>Autor: Jakub Grzegorczyk</h2>
|
||
</header>
|
||
<div class="box">
|
||
<p>Napisz program, który dla stałej haslo=’Jagoda’ sprawdza czy wprowadzony z klawiatury ciąg znaków jest zgodny z hasłem.</p>
|
||
</div>
|
||
<div class="box">
|
||
<form action="index.php" method="post">
|
||
<fieldset>
|
||
<label for="haslo">Podaj hasło:</label>
|
||
<input type="password" name="haslo" id="haslo" required>
|
||
</fieldset>
|
||
<button type="submit">Wyślij</button>
|
||
</form>
|
||
</div>
|
||
<?php
|
||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||
$haslo = htmlspecialchars($_POST['haslo']);
|
||
echo '<div class="box">';
|
||
if ($haslo == 'Jagoda') {
|
||
echo "Hasło jest prawidłowe";
|
||
} else {
|
||
echo "Hasło <i>{$haslo}</i> jest błędne";
|
||
}
|
||
}
|
||
?>
|
||
</body>
|
||
</html>
|