38 lines
858 B
PHP
38 lines
858 B
PHP
|
<?php
|
||
|
session_start();
|
||
|
|
||
|
if (isset($_POST["nev"]) && !isset($_SESSION["user"])) {
|
||
|
$_SESSION["user"] = $_POST["nev"];
|
||
|
setcookie("szin", $_POST["szin"], time() + (60 * 60 * 24));
|
||
|
$szin = $_POST["szin"];
|
||
|
}
|
||
|
else if ($_SESSION["user"]) {
|
||
|
$szin = $_COOKIE["szin"];
|
||
|
}
|
||
|
else {
|
||
|
header(header: "Location: login.php");
|
||
|
exit();
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
<!DOCTYPE html>
|
||
|
<html lang="hu">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Profil</title>
|
||
|
<style>
|
||
|
body {
|
||
|
background-color: <?php echo $szin ?>;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<?php
|
||
|
echo "Név: ". $_SESSION["user"]. "<br>";
|
||
|
echo "Választott szín: ". $szin;
|
||
|
?>
|
||
|
<br><a href="logout.php">Kijelentkezés</a>
|
||
|
</body>
|
||
|
</html>
|