Källkod
Följande filer och mappar finns under mappen webbserverprogrammering.
Mappar visas till vänster och filer till höger. Klicka på en fil eller mapp för att öppna nedan eller visa dess innehåll.
webbserverprogrammering/exercises/cookies_and_sessions/
7 filer
cookies_sessions_1.php
cookies_sessions_2.php
cookies_sessions_3.php
cookies_sessions_3_secret.php
cookies_sessions_4.php
cookies_sessions_5.php
cookies_sessions_5_mail.php
cookies_sessions_2.php
cookies_sessions_3.php
cookies_sessions_3_secret.php
cookies_sessions_4.php
cookies_sessions_5.php
cookies_sessions_5_mail.php
cookies_sessions_1.php
32 lines UTF-8 Windows (CRLF)
<?php
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all errors
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
?>
<?php
setcookie("timer", "resets after some time to welcome a new person", time()+10, "/");
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<title>Cookies 1</title>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: Arial;
}
</style>
</head>
<body>
<?php
if (isset($_COOKIE["timer"]))
echo "<h1>Välkommen TILLBAKA!</h1>";
else
echo "<h1>Välkommen för FÖRSTA GÅNGEN!</h1><h3>(eller mer än 10 sekunder sen...)</h3>";
?>
</body>
</html>