added orai
This commit is contained in:
parent
62a2e4cf1b
commit
de58d64213
31
20241015/index.php
Normal file
31
20241015/index.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?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>
|
19
20241015/main.php
Normal file
19
20241015/main.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<!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 style="background-color: <?php echo $_COOKIE["color"]?>;">
|
||||
<form action="index.php" method="POST">
|
||||
<input type="hidden" name="logout" value="1">
|
||||
<button type="submit">
|
||||
Kijelentkezés
|
||||
</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
31
20241015/redirected.php
Normal file
31
20241015/redirected.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<!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>
|
||||
<?php
|
||||
|
||||
$_SESSION["username"] = $_POST["username"];
|
||||
$_SESSION["password"] = $_POST["password"];
|
||||
|
||||
setcookie("color", $_POST["color"], time() + (86400), "/");
|
||||
$_COOKIE["color"] = $_POST["color"];
|
||||
|
||||
|
||||
|
||||
echo "Üdvözöllek! <br>";
|
||||
echo $_SESSION["username"];
|
||||
echo "<br>";
|
||||
echo $_SESSION["password"];
|
||||
echo "<br>";
|
||||
echo $_COOKIE["color"];
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user