home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / testsessions.php < prev    next >
Encoding:
PHP Script  |  2004-03-20  |  1.6 KB  |  66 lines

  1. <?php
  2.  
  3. /* 
  4. V4.21 20 Mar 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
  5.   Released under both BSD license and Lesser GPL library license. 
  6.   Whenever there is any discrepancy between the two licenses, 
  7.   the BSD license will take precedence. 
  8.   Set tabs to 4 for best viewing.
  9.     
  10.   Latest version is available at http://php.weblogs.com/
  11. */
  12.  
  13. function NotifyExpire($ref,$key)
  14. {
  15.     print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
  16. }
  17.  
  18. //-------------------------------------------------------------------
  19.     
  20.     
  21. #### CONNECTION
  22.     $ADODB_SESSION_DRIVER='oci8';
  23.     $ADODB_SESSION_CONNECT='';
  24.     $ADODB_SESSION_USER ='scott';
  25.     $ADODB_SESSION_PWD ='natsoft';
  26.     $ADODB_SESSION_DB ='';
  27.     
  28.     
  29. ### TURN DEBUGGING ON
  30.     $ADODB_SESS_DEBUG = true;
  31.  
  32.     
  33. #### SETUP NOTIFICATION
  34.     $USER = 'JLIM'.rand();
  35.     $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
  36.  
  37.     
  38. #### INIT
  39.     ob_start();
  40.     error_reporting(E_ALL);
  41.     include('../session/adodb-cryptsession.php');
  42.     session_start();
  43.  
  44.  
  45. ### SETUP SESSION VARIABLES 
  46.     $HTTP_SESSION_VARS['MONKEY'] = array('1','abc',44.41);
  47.     if (!isset($HTTP_GET_VARS['nochange'])) @$HTTP_SESSION_VARS['AVAR'] += 1;
  48.  
  49.     
  50. ### START DISPLAY
  51.     print "<h3>PHP ".PHP_VERSION."</h3>";
  52.     print "<p><b>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</b></p>";
  53.     
  54.     print "<hr> <b>Cookies</b>: ";
  55.     print_r($HTTP_COOKIE_VARS);
  56.     
  57. ### RANDOMLY PERFORM Garbage Collection
  58.     if (rand() % 10 == 0) {
  59.     
  60.         print "<hr><p><b>Garbage Collection</b></p>";
  61.         adodb_sess_gc(10);
  62.         
  63.         print "<p>Random session destroy</p>";
  64.         session_destroy();
  65.     }
  66. ?>