Polished.
[moodle.git] / lib / session-test.php
blob5468b2a132ec4a7ddc8e4eea86b1a5365a7c6272
1 <?PHP
2 /// This is a tiny standalone diagnostic script to test that sessions
3 /// are working correctly on a given server.
4 ///
5 /// Just run it from a browser. The first time you run it will
6 /// set a new variable, and after that it will try to find it again.
7 /// The random number is just to prevent browser caching.
9 session_start();
11 if (!isset($_SESSION["test"])) { // First time you call it.
12 echo "<P>No session found - starting a session now.";
13 $_SESSION["test"] = "welcome back!";
15 } else { // Subsequent times you call it
16 echo "<P>Session found - ".$_SESSION["test"];
17 echo "<P>Sessions are working correctly</P>";
20 echo "<P><A HREF=\"session-test.php?random=".rand(1,10000)."\">Reload this page</A></P>";