6 V4.80 8 Mar 2006 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved.
7 Released under both BSD license and Lesser GPL library license.
8 Whenever there is any discrepancy between the two licenses,
9 the BSD license will take precedence.
10 Set tabs to 4 for best viewing.
12 Latest version is available at http://adodb.sourceforge.net
15 function NotifyExpire($ref,$key)
17 print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
20 //-------------------------------------------------------------------
22 error_reporting(E_ALL
);
26 include('../session/adodb-cryptsession2.php');
29 $options['debug'] = 1;
35 $options['table'] = 'adodb_sessions2';
36 ADOdb_Session
::config('oci8', 'mobydick', 'jdev', 'natsoft', 'mobydick',$options);
40 $options['table'] = 'sessions2';
41 ADOdb_Session
::config('postgres', 'localhost', 'postgres', 'natsoft', 'northwind',$options);
46 $options['table'] = 'sessions2';
47 ADOdb_Session
::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options);
55 #### SETUP NOTIFICATION
56 $USER = 'JLIM'.rand();
57 $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
59 adodb_session_create_table();
62 adodb_session_regenerate_id();
64 ### SETUP SESSION VARIABLES
65 if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41);
66 else $_SESSION['MONKEY'][0] +
= 1;
67 if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] +
= 1;
71 print "<h3>PHP ".PHP_VERSION
."</h3>";
72 print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
74 print "<hr /> <b>Cookies</b>: ";
77 var_dump($_SESSION['MONKEY']);
79 ### RANDOMLY PERFORM Garbage Collection
80 ### In real-production environment, this is done for you
81 ### by php's session extension, which calls adodb_sess_gc()
82 ### automatically for you. See php.ini's
83 ### session.cookie_lifetime and session.gc_probability
85 if (rand() %
5 == 0) {
87 print "<hr /><p><b>Garbage Collection</b></p>";
90 if (rand() %
2 == 0) {
91 print "<p>Random own session destroy</p>";
95 $DB = ADODB_Session
::_conn();
96 $sessk = $DB->qstr('%AZ'.rand().time());
97 $olddate = $DB->DBTimeStamp(time()-30*24*3600);
98 $rr = $DB->qstr(rand());
99 $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ($sessk,$olddate, $rr,'',$olddate,$olddate)");