2004-09-12 13:21:01 +00:00
|
|
|
<?php
|
2003-01-11 13:58:17 +00:00
|
|
|
/// This is a tiny standalone diagnostic script to test that sessions
|
|
|
|
/// are working correctly on a given server.
|
|
|
|
///
|
|
|
|
/// Just run it from a browser. The first time you run it will
|
|
|
|
/// set a new variable, and after that it will try to find it again.
|
|
|
|
/// The random number is just to prevent browser caching.
|
|
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
if (!isset($_SESSION["test"])) { // First time you call it.
|
2004-09-12 13:21:01 +00:00
|
|
|
echo "<p>No session found - starting a session now.";
|
2003-01-11 13:58:17 +00:00
|
|
|
$_SESSION["test"] = "welcome back!";
|
|
|
|
|
|
|
|
} else { // Subsequent times you call it
|
2004-09-12 13:21:01 +00:00
|
|
|
echo "<p>Session found - ".$_SESSION["test"];
|
|
|
|
echo "</p><p>Sessions are working correctly</p>";
|
2003-01-11 13:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-09-12 13:21:01 +00:00
|
|
|
echo "<p><a href=\"session-test.php?random=".rand(1,10000)."\">Reload this page</a></p>";
|
2003-01-11 13:58:17 +00:00
|
|
|
|
|
|
|
?>
|