[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/ -> session-test.php (source)

   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.
   8  
   9  session_start();
  10  
  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!";
  14  
  15  } else {                           // Subsequent times you call it
  16      echo "<p>Session found - ".$_SESSION["test"];
  17      echo "</p><p>Sessions are working correctly</p>";
  18  }
  19  
  20  echo "<p><a href=\"session-test.php?random=".rand(1,10000)."\">Reload this page</a></p>";
  21  
  22  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7