Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/cookie-session/
ovn_cook1.php
ovn_cook2.php
ovn_cook3.php
ovn_cook3hem.php
ovn_cook4.php
ovn_cook5.php
ovn_cook2.php
33 lines UTF-8 Windows (CRLF)
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cookie-Session 2</title>
</head>
<body>
<?php
if (!isset($_SESSION["time"])) {
$_SESSION["time"] = time();
}
else{
$_SESSION["time2"] = time();
$skillnad = ($_SESSION["time2"]) - ($_SESSION["time"]);
if ($skillnad < 10) {
echo "Välkommen tillbaka";
}
else{
$_SESSION["time"] = time();
}
}
?>
</body>
</html>