[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/adodb/tests/ -> testsessions.php (source)

   1  <?php
   2  
   3  /* 
   4  V4.80 8 Mar 2006  (c) 2000-2006 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  error_reporting(E_ALL);
  21  
  22  #### CONNECTION
  23  if (0) {
  24      $ADODB_SESSION_DRIVER='oci8';
  25      $ADODB_SESSION_CONNECT='';
  26      $ADODB_SESSION_USER ='scott';
  27      $ADODB_SESSION_PWD ='natsoft';
  28      $ADODB_SESSION_DB ='';
  29  } else {
  30      $ADODB_SESSION_DRIVER='mysql';
  31      $ADODB_SESSION_CONNECT='localhost';
  32      $ADODB_SESSION_USER ='root';
  33      $ADODB_SESSION_PWD ='';
  34      $ADODB_SESSION_DB ='xphplens_2';
  35  }
  36      
  37  ### TURN DEBUGGING ON
  38      $ADODB_SESS_DEBUG = 99;
  39  
  40      
  41  #### SETUP NOTIFICATION
  42      $USER = 'JLIM'.rand();
  43      $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
  44  
  45      
  46  #### INIT
  47      ob_start();
  48      include ('../session/adodb-cryptsession.php');
  49      session_start();
  50  
  51      adodb_session_regenerate_id();
  52      
  53  ### SETUP SESSION VARIABLES 
  54      $_SESSION['MONKEY'] = array('1','abc',44.41);
  55      if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1;
  56  
  57      
  58  ### START DISPLAY
  59      print "<h3>PHP ".PHP_VERSION."</h3>";
  60      print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
  61      
  62      print "<hr /> <b>Cookies</b>: ";
  63      print_r($_COOKIE);
  64      
  65  ### RANDOMLY PERFORM Garbage Collection
  66  ### In real-production environment, this is done for you
  67  ### by php's session extension, which calls adodb_sess_gc()
  68  ### automatically for you. See php.ini's
  69  ### session.cookie_lifetime and session.gc_probability
  70  
  71      if (rand() % 5 == 0) {
  72      
  73          print "<hr /><p><b>Garbage Collection</b></p>";
  74          adodb_sess_gc(10);
  75          
  76          if (rand() % 2 == 0) {
  77              print "<p>Random session destroy</p>";
  78              session_destroy();
  79          }
  80      }
  81  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7