home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / testsessions.php < prev    next >
Encoding:
PHP Script  |  2005-01-24  |  1.8 KB  |  73 lines

  1. <?php
  2.  
  3. /* 
  4. V4.60 24 Jan 2005  (c) 2000-2005 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://adodb.sourceforge.net
  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. if (1) {
  23.     $ADODB_SESSION_DRIVER='oci8';
  24.     $ADODB_SESSION_CONNECT='';
  25.     $ADODB_SESSION_USER ='scott';
  26.     $ADODB_SESSION_PWD ='natsoft';
  27.     $ADODB_SESSION_DB ='';
  28. } else {
  29.     $ADODB_SESSION_DRIVER='mysql';
  30.     $ADODB_SESSION_CONNECT='localhost';
  31.     $ADODB_SESSION_USER ='root';
  32.     $ADODB_SESSION_PWD ='';
  33.     $ADODB_SESSION_DB ='xphplens_2';
  34. }
  35.     
  36. ### TURN DEBUGGING ON
  37.     $ADODB_SESS_DEBUG = true;
  38.  
  39.     
  40. #### SETUP NOTIFICATION
  41.     $USER = 'JLIM'.rand();
  42.     $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
  43.  
  44.     
  45. #### INIT
  46.     ob_start();
  47.     error_reporting(E_ALL);
  48.     include('../session/adodb-cryptsession.php');
  49.     session_start();
  50.  
  51.  
  52. ### SETUP SESSION VARIABLES 
  53.     $HTTP_SESSION_VARS['MONKEY'] = array('1','abc',44.41);
  54.     if (!isset($HTTP_GET_VARS['nochange'])) @$HTTP_SESSION_VARS['AVAR'] += 1;
  55.  
  56.     
  57. ### START DISPLAY
  58.     print "<h3>PHP ".PHP_VERSION."</h3>";
  59.     print "<p><b>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</b></p>";
  60.     
  61.     print "<hr> <b>Cookies</b>: ";
  62.     print_r($HTTP_COOKIE_VARS);
  63.     
  64. ### RANDOMLY PERFORM Garbage Collection
  65.     if (rand() % 10 == 0) {
  66.     
  67.         print "<hr><p><b>Garbage Collection</b></p>";
  68.         adodb_sess_gc(10);
  69.         
  70.         print "<p>Random session destroy</p>";
  71.         session_destroy();
  72.     }
  73. ?>