<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <?php if ((!isset($_POST['name'])) || (!isset($_POST['password']))) { ?> <h1>Prihlaste sa prosim</h1> <form method="$_POST" action="secret.php"> <p><label for="name">Uzivatelske meno</label> <input type="text" name="name" id="name" size="15"></p> <p><label for="password">Heslo</label> <input type="password" name="password" id="password" size="15"></p> <button type="submit" name="submit">Prihlasit</button> </form> <?php } else if(($_POST['name'] == 'uzivatel') && ($_POST['password'] == 'heslo')) { // kombinacia mena a hesla je spravna echo '<h1>A je to!</h1>'; } else { echo 'Neste opravneni pouzivat tuto stranku'; } ?> </body> </html>
method
"get"
"post"
<form method="post" action="secret.php">
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)