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_2.php
27 lines UTF-8 Windows (CRLF)
<?php
session_start();
if(!isset($_SESSION["time"])){
$_SESSION["time"] = time();
}
?>
<!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 2</title>
</head>
<body>
<?php
if(time() - $_SESSION["time"] > 10){
session_destroy();
echo "Välkommen! Din information kommer att sparas i 10s (starta om sidan för att se).";
} else {
echo "Jag vet att du har varit här >:)";
}
?>
</body>
</html>