Changeset 34 for trunk/phpgwapi/inc/adodb/session/old
- Timestamp:
- 06/29/07 15:17:46 (17 years ago)
- Location:
- trunk/phpgwapi/inc/adodb/session/old
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.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.94 23 Jan 2007 (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, … … 19 19 ======= 20 20 21 GLOBAL $HTTP_SESSION_VARS;22 21 include('adodb.inc.php'); 23 22 #---------------------------------# … … 26 25 session_start(); 27 26 session_register('AVAR'); 28 $HTTP_SESSION_VARS['AVAR'] += 1; 29 print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 27 $_SESSION['AVAR'] += 1; 28 print " 29 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 30 30 31 31 … … 193 193 194 194 if (!$rs) { 195 ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 195 ADOConnection::outp( ' 196 -- Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false); 196 197 } else { 197 198 // bug in access driver (could be odbc?) means that info is not commited … … 264 265 if (defined('ADODB_SESSION_OPTIMIZE')) 265 266 { 267 global $ADODB_SESSION_DRIVER; 268 266 269 switch( $ADODB_SESSION_DRIVER ) { 267 270 case 'mysql': … … 287 290 $t = time(); 288 291 if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 289 global $HTTP_SERVER_VARS;290 292 $msg = 291 __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)";293 __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 292 294 error_log($msg); 293 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 295 if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 296 -- $msg</p>"); 294 297 } 295 298 } … … 311 314 /* 312 315 if (0) { 313 GLOBAL $HTTP_SESSION_VARS;314 316 315 317 session_start(); 316 318 session_register('AVAR'); 317 $HTTP_SESSION_VARS['AVAR'] += 1; 318 print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>"; 319 $_SESSION['AVAR'] += 1; 320 print " 321 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>"; 319 322 } 320 323 */ -
trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.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 … … 58 58 $ADODB_SESSION_USE_LOBS = false; (or, if you wanna use CLOBS (= 'CLOB') or ( = 'BLOB') 59 59 60 3. Recommended is PHP 4. 0.6or later. There are documented60 3. Recommended is PHP 4.1.0 or later. There are documented 61 61 session bugs in earlier versions of PHP. 62 62 … … 192 192 $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB); 193 193 194 if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false); 194 if (!$ok) ADOConnection::outp( " 195 -- Session: connection failed</p>",false); 195 196 } 196 197 … … 253 254 // now we only update expiry date, thx to sebastian thom in adodb 2.32 254 255 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>"; 256 if ($ADODB_SESS_DEBUG) echo " 257 -- Session: Only updating date - crc32 not changed</p>"; 256 258 $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time(); 257 259 $rs = $ADODB_SESS_CONN->Execute($qry); … … 312 314 313 315 if (!$rs) { 314 ADOConnection::outp( '<p>Session Replace: '.nl2br($err).'</p>',false); 316 ADOConnection::outp( ' 317 -- Session Replace: '.nl2br($err).'</p>',false); 315 318 } else { 316 319 // bug in access driver (could be odbc?) means that info is not commited … … 379 382 $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time()); 380 383 381 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>"); 384 if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 385 -- <b>Garbage Collection</b>: $qry</p>"); 382 386 } 383 387 // suggested by Cameron, "GaM3R" <gamr@outworld.cx> … … 410 414 $t = time(); 411 415 if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { 412 global $HTTP_SERVER_VARS;413 416 $msg = 414 __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)";417 __FILE__.": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)"; 415 418 error_log($msg); 416 if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>"); 419 if ($ADODB_SESS_DEBUG) ADOConnection::outp(" 420 -- $msg</p>"); 417 421 } 418 422 } … … 434 438 435 439 if (0) { 436 GLOBAL $HTTP_SESSION_VARS;437 440 438 441 session_start(); 439 442 session_register('AVAR'); 440 $HTTP_SESSION_VARS['AVAR'] += 1; 441 ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false); 443 $_SESSION['AVAR'] += 1; 444 ADOConnection::outp( " 445 -- \$_SESSION['AVAR']={$_SESSION['AVAR']}</p>",false); 442 446 } 443 447 -
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.