00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 function NotifyExpire($ref,$key)
00014 {
00015 print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
00016 }
00017
00018
00019
00020 error_reporting(E_ALL);
00021
00022 #### CONNECTION
00023 if (0) {
00024 $ADODB_SESSION_DRIVER='oci8';
00025 $ADODB_SESSION_CONNECT='';
00026 $ADODB_SESSION_USER ='scott';
00027 $ADODB_SESSION_PWD ='natsoft';
00028 $ADODB_SESSION_DB ='';
00029 } else {
00030 $ADODB_SESSION_DRIVER='mysql';
00031 $ADODB_SESSION_CONNECT='localhost';
00032 $ADODB_SESSION_USER ='root';
00033 $ADODB_SESSION_PWD ='';
00034 $ADODB_SESSION_DB ='xphplens_2';
00035 }
00036
00037 ### TURN DEBUGGING ON
00038 $ADODB_SESS_DEBUG = 99;
00039
00040
00041 #### SETUP NOTIFICATION
00042 $USER = 'JLIM'.rand();
00043 $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
00044
00045
00046 #### INIT
00047 ob_start();
00048 include('../session/adodb-cryptsession.php');
00049 session_start();
00050
00051 adodb_session_regenerate_id();
00052
00053 ### SETUP SESSION VARIABLES
00054 $_SESSION['MONKEY'] = array('1','abc',44.41);
00055 if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1;
00056
00057
00058 ### START DISPLAY
00059 print "<h3>PHP ".PHP_VERSION."</h3>";
00060 print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
00061
00062 print "<hr /> <b>Cookies</b>: ";
00063 print_r($_COOKIE);
00064
00065 ### RANDOMLY PERFORM Garbage Collection
00066 ### In real-production environment, this is done for you
00067 ### by php's session extension, which calls adodb_sess_gc()
00068 ### automatically for you. See php.ini's
00069 ### session.cookie_lifetime and session.gc_probability
00070
00071 if (rand() % 5 == 0) {
00072
00073 print "<hr /><p><b>Garbage Collection</b></p>";
00074 adodb_sess_gc(10);
00075
00076 if (rand() % 2 == 0) {
00077 print "<p>Random session destroy</p>";
00078 session_destroy();
00079 }
00080 }
00081 ?>