Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/exercises/cookies-session/
ovning_1.php
ovning_2.php
ovning_3.php
ovning_3_mottagare.php
ovning_4.php
ovning_1.php
23 lines UTF-8 Windows (CRLF)
<?php
$cookie_name = "user";
$cookie_value = "Tobias";
setcookie($cookie_name, $cookie_value, time() + 10, "/")
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
<title>Övning 1</title>
</head>
<body>
<?php
if(!isset($_COOKIE[$cookie_name])) {
echo "Välkommen till denna sida! Starta om inom 10s för att din cookie inte ska bort!";
} else {
echo "Jag vet att du har varit här förut >:)";
}
?>
</body>
</html>