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_3_secret.php
53 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
session_start();
if (!isset($_SESSION["loggedIn"]) || !$_SESSION["loggedIn"])
header("Location: cookies_sessions_3.php");
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<title>Hemligt, Session 3</title>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: Arial;
}
</style>
</head>
<body>
<h1>Hemligheter</h1>
<p>Detta är en hemlig sida, du är speciellt utvald till att få besöka detta mästerliga verk.</p>
<?php
/*
if (isset($_SESSION["time"]) && $_SESSION["time"] > time()-10) {
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>";
}
?>
<br>
<p>Sessions-ID: <code><?php echo session_id(); ?></code></p>
<?php
$_SESSION["time"] = time();*/
?>
</body>
</html>