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

cookie1.php

21 lines UTF-8 Windows (CRLF)
<?php
setcookie
("myCookie""Kakor är gott!"time() + 10"/")
?>
<!DOCTYPE html>
<html lang="sv">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Åh en kaka, vad gott!</title>
</head>
<body>
  <?php
  
if (isset($_COOKIE["myCookie"])) {
    echo 
"<p>Kakan har talat, den säger: " $_COOKIE["myCookie"] . "</p>";
  }
  else {
    echo 
"<p>Kakan sover, ladda om sidan för att väcka den.</p>";
  }
  
?>
</body>
</html>