]> git.mjollnir.org Git - moodle.git/commitdiff
A small standalone test program to test session support
authormoodler <moodler>
Sat, 11 Jan 2003 13:58:17 +0000 (13:58 +0000)
committermoodler <moodler>
Sat, 11 Jan 2003 13:58:17 +0000 (13:58 +0000)
lib/session-test.php [new file with mode: 0644]

diff --git a/lib/session-test.php b/lib/session-test.php
new file mode 100644 (file)
index 0000000..6ef403e
--- /dev/null
@@ -0,0 +1,22 @@
+<?PHP
+/// 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.
+    echo "<P>No session found - starting a session now.";
+    $_SESSION["test"] = "welcome back!";
+
+} else {                           // Subsequent times you call it
+    echo "<P>Session found (".$_SESSION["test"].")!";
+    echo "<P>Sessions are working correctly</P>";
+}
+
+echo "<P><A HREF=\"session-test.php?random=".rand(1,1000000)."\">Reload this page</A></P>"
+
+?>