4 V4.80 8 Mar 2006 (c) 2000-2012 John Lim (jlim#natsoft.com). 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.
10 Latest version is available at http://adodb.sourceforge.net
13 function NotifyExpire($ref,$key)
15 print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
18 //-------------------------------------------------------------------
20 error_reporting(E_ALL);
24 include('../session/adodb-cryptsession2.php');
27 $options['debug'] = 1;
33 $options['table'] = 'adodb_sessions2';
34 ADOdb_Session::config('oci8', 'mobydick', 'jdev', 'natsoft', 'mobydick',$options);
38 $options['table'] = 'sessions2';
39 ADOdb_Session::config('postgres', 'localhost', 'postgres', 'natsoft', 'northwind',$options);
44 $options['table'] = 'sessions2';
45 ADOdb_Session::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options);
53 #### SETUP NOTIFICATION
54 $USER = 'JLIM'.rand();
55 $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
57 adodb_session_create_table();
60 adodb_session_regenerate_id();
62 ### SETUP SESSION VARIABLES
63 if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41);
64 else $_SESSION['MONKEY'][0] += 1;
65 if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1;
69 print "<h3>PHP ".PHP_VERSION."</h3>";
70 print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
72 print "<hr /> <b>Cookies</b>: ";
75 var_dump($_SESSION['MONKEY']);
77 ### RANDOMLY PERFORM Garbage Collection
78 ### In real-production environment, this is done for you
79 ### by php's session extension, which calls adodb_sess_gc()
80 ### automatically for you. See php.ini's
81 ### session.cookie_lifetime and session.gc_probability
83 if (rand() % 5 == 0) {
85 print "<hr /><p><b>Garbage Collection</b></p>";
88 if (rand() % 2 == 0) {
89 print "<p>Random own session destroy</p>";
93 $DB = ADODB_Session::_conn();
94 $sessk = $DB->qstr('%AZ'.rand().time());
95 $olddate = $DB->DBTimeStamp(time()-30*24*3600);
96 $rr = $DB->qstr(rand());
97 $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ($sessk,$olddate, $rr,'',$olddate,$olddate)");