Changeset 34 for trunk/phpgwapi/inc/adodb/session/old/adodb-session.php
- Timestamp:
- 06/29/07 15:17:46 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/adodb/session/old/adodb-session.php
r2 r34 1 1 <?php 2 2 /* 3 V4. 51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.3 V4.93 10 Oct 2006 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 4 4 Released under both BSD license and Lesser GPL library license. 5 5 Whenever there is any discrepancy between the two licenses, … … 16 16 ======= 17 17 18 GLOBAL $HTTP_SESSION_VARS;19 18 include('adodb.inc.php'); 20 19 include('adodb-session.php'); 21 20 session_start(); 22 21 session_register('AVAR'); 23 $HTTP_SESSION_VARS['AVAR'] += 1; 24 print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 22 $_SESSION['AVAR'] += 1; 23 print " 24 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 25 25 26 26 To force non-persistent connections, call adodb_session_open first before session_start(): 27 27 28 GLOBAL $HTTP_SESSION_VARS;29 28 include('adodb.inc.php'); 30 29 include('adodb-session.php'); … … 32 31 session_start(); 33 32 session_register('AVAR'); 34 $HTTP_SESSION_VARS['AVAR'] += 1; 35 print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 33 $_SESSION['AVAR'] += 1; 34 print " 35 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 36 36 37 37 … … 68 68 $ADODB_SESSION_TBL = 'sessions' 69 69 70 3. Recommended is PHP 4. 0.6or later. There are documented70 3. Recommended is PHP 4.1.0 or later. There are documented 71 71 session bugs in earlier versions of PHP. 72 72 … … 107 107 /* if database time and system time is difference is greater than this, then give warning */ 108 108 define('ADODB_SESSION_SYNCH_SECS',60); 109 110 /* 111 Thanks Joe Li. See http://phplens.com/lens/lensforum/msgs.php?id=11487&x=1 112 */ 113 function adodb_session_regenerate_id() 114 { 115 $conn =& ADODB_Session::_conn(); 116 if (!$conn) return false; 117 118 $old_id = session_id(); 119 if (function_exists('session_regenerate_id')) { 120 session_regenerate_id(); 121 } else { 122 session_id(md5(uniqid(rand(), true))); 123 $ck = session_get_cookie_params(); 124 setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']); 125 //@session_start(); 126 } 127 $new_id = session_id(); 128 $ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id)); 129 130 /* it is possible that the update statement fails due to a collision */ 131 if (!$ok) { 132 session_id($old_id); 133 if (empty($ck)) $ck = session_get_cookie_params(); 134 setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']); 135 return false; 136 } 137 138 return true; 139 } 109 140 110 141 /****************************************************************************************\ … … 194 225 $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB); 195 226 196 if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false); 227 if (!$ok) ADOConnection::outp( " 228 -- Session: connection failed</p>",false); 197 229 } 198 230 … … 253 285 // now we only update expiry date, thx to sebastian thom in adodb 2.32 254 286 if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) { 255 if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>"; 287 if ($ADODB_SESS_DEBUG) echo " 288 -- Session: Only updating date - crc32 not changed</p>"; 256 289 $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time(); 257 290 $rs = $ADODB_SESS_CONN->Execute($qry); … … 270 303 271 304 if (!$rs) { 272 ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 305 ADOConnection::outp( ' 306 -- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 273 307 } else { 274 308 // bug in access driver (could be odbc?) means that info is not commited … … 337 371 $ADODB_SESS_CONN->Execute($qry); 338 372 339 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>"); 373 if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 374 -- <b>Garbage Collection</b>: $qry</p>"); 340 375 } 341 376 // suggested by Cameron, "GaM3R" <gamr@outworld.cx> … … 369 404 370 405 if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 371 global $HTTP_SERVER_VARS;406 372 407 $msg = 373 __FILE__.": Server time for webserver {$ HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";408 __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 374 409 error_log($msg); 375 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 410 if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 411 -- $msg</p>"); 376 412 } 377 413 } … … 393 429 394 430 if (0) { 395 GLOBAL $HTTP_SESSION_VARS;396 431 397 432 session_start(); 398 433 session_register('AVAR'); 399 $HTTP_SESSION_VARS['AVAR'] += 1; 400 ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false); 434 $_SESSION['AVAR'] += 1; 435 ADOConnection::outp( " 436 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false); 401 437 } 402 438
Note: See TracChangeset
for help on using the changeset viewer.