Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserverprogrammering/exercises/cookie-session/

cookie-session1.php
cookie-session2.php
cookie-session3.php
cookie-session4.php
cookie-session5.php
hemlig.php

cookie-session2.php

23 lines UTF-8 Windows (CRLF)
<?php 
session_start
();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>session</title>
</head>

<body>
<?php 
 
if (isset($_SESSION["tid"]) && (time()-$_SESSION["tid"])<3600) {
  echo 
"Välkommen tillbaka";
 }
 else{
  
$_SESSION["tid"] = time();
  echo 
"Första besöket";
 }
?>

</body>
</html>