php repozitar
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.1 KiB

<?php
session_start();
?>
<!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>Login system</title>
</head>
<body>
<h1>Login</h1>
<form action="auth.php" method="post">
<input type="text" name="username" id="username" placeholder="Username">
<input type="password" name="password" id="password" placeholder="Password">
<input type="submit" value="Login">
</form>
<?php
//zjištění stavů a jejich "zpětná vazba"
if(isset($_SESSION["username"])){
echo "<p>Přihlášený uživatel:". $_SESSION["username"]."</p>";
echo "<a href=\"logout.php\">LOGOUT</a>"; // \" escape uvozovek pro odkaz
}
if(isset($_GET["error"])){
echo "<p>Error ". $_GET["error"]. "</p>";
}
if(isset($_GET["login"])){
echo "<p>Uživatel byl přihlášen</p>";
}
if(isset($_GET["logout"])){
echo "<p>Uživatel byl odhlášený</p>";
}
?>
</body>
</html>