Backend/20241015/index.php
2024-10-15 09:03:36 +02:00

31 lines
934 B
PHP

<?php
session_start();
if (isset($_POST["logout"]) && $_POST["logout"] == 1){
unset($_SESSION["username"]);
unset($_SESSION["password"]);
unset($_COOKIE["color"]);
setcookie("color", "", time() + -1, "/");
session_destroy();
$_POST["logout"] = 0;
} else if (isset($_SESSION["username"]) && isset($_SESSION["password"])){
header("Location: main.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="redirected.php" method="POST">
Név: <input type="text" name="username"> <br>
Jelszó: <input type="password" name="password"> <br>
Szín: <input type="color" name="color" id=""> <br>
<button type="submit">Bejelentkezés</button>
</form>
</body>
</html>