Webbserverprogrammering 1

Show sourcecode

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

Webserver1/Ovningar/Cookie/

cookie1.php
cookie2.php
cookie3login.php
cookie3secret.php
cookie4.php
cookie5.php

cookie2.php

24 lines UTF-8 Windows (CRLF)
<?php
session_start
();
?>
<!DOCTYPE html>
<html lang="sv">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vänta, det här är ingen kaka, det är en session!</title>
</head>

<body>
  <?php
  
if (time() - $_SESSION['lastVisit'] <= 10) {
    echo 
"Välkommen tillbaka.";
  } else {
    echo 
"Välkommen... inte tillbaka.";
  }
  
$_SESSION['lastVisit'] = time();
  
?>
</body>

</html>