v5:session:session_index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v5:session:session_index [2016/05/16 02:16] – mnewnham | v5:session:session_index [2018/07/01 21:57] – fix typo in example peterdd | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Session Management ====== | ||
+ | ~~NOTOC~~ | ||
<WRAP right box> | <WRAP right box> | ||
[[v5: | [[v5: | ||
- | [[v5: | + | [[v5: |
- | </ | + | |
- | ====== Session Management ====== | + | |
- | <WRAP important> | + | |
- | The original session management routines that use '' | + | |
</ | </ | ||
+ | |||
===== Introduction ===== | ===== Introduction ===== | ||
ADOdb session management extends the standard functionality of PHP sessions, by allowing the normal session data seen to be stored in a database itself. There are numerous ways that this method enhances the default behavior | ADOdb session management extends the standard functionality of PHP sessions, by allowing the normal session data seen to be stored in a database itself. There are numerous ways that this method enhances the default behavior | ||
Line 88: | Line 87: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | ADOdb_session::Persist($connectMode=false); | + | ADOdb_Session::persist($connectMode=false); |
session_start(); | session_start(); | ||
Line 102: | Line 101: | ||
</ | </ | ||
- | The parameter to the '' | + | <WRAP important> |
- | + | The original session management routines that use '' | |
- | ^$connectMode^Connection Method^ | + | </ |
- | ^true|PConnect()| | + | |
- | ^false|Connect()| | + | |
- | ^' | + | |
- | ^' | + | |
- | ^' | + | |
===== Using Encrypted Sessions ===== | ===== Using Encrypted Sessions ===== | ||
To use a encrypted sessions, replace the file '' | To use a encrypted sessions, replace the file '' | ||
Line 123: | Line 116: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | adodb_sess_open(false, | ||
session_start(); | session_start(); | ||
</ | </ | ||
Line 138: | Line 130: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | adodb_sess_open(false, | ||
session_start(); | session_start(); | ||
</ | </ | ||
Line 150: | Line 141: | ||
CREATE TABLE sessions2( | CREATE TABLE sessions2( | ||
sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', | sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', | ||
- | | + | |
expireref VARCHAR( 250 ) DEFAULT '', | expireref VARCHAR( 250 ) DEFAULT '', | ||
created DATETIME NOT NULL , | created DATETIME NOT NULL , | ||
Line 227: | Line 218: | ||
$user = $ADODB_SESS_CONN-> | $user = $ADODB_SESS_CONN-> | ||
- | $ADODB_SESS_CONN-> | + | $ADODB_SESS_CONN-> |
system(" | system(" | ||
} | } | ||
Line 266: | Line 257: | ||
will compress and then encrypt the record in the database. | will compress and then encrypt the record in the database. | ||
- | ===== Session Cookie Regeneration ===== | ||
- | The method '' | ||
- | ==== Usage ==== | ||
- | |||
- | <code php> | ||
- | include ' | ||
- | |||
- | session_start(); | ||
- | /* | ||
- | * Approximately every 10 page loads, reset cookie for safety. | ||
- | * This is extremely simplistic example, better | ||
- | * to regenerate only when the user logs in or changes | ||
- | * user privilege levels. | ||
- | */ | ||
- | if ((rand()%10) == 0) | ||
- | adodb_session_regenerate_id(); | ||
- | </ | ||
- | |||
- | This function calls '' | ||
- | |||
- | ===== Vacuum/ | ||
- | |||
- | During session garbage collection, if postgresql is detected, ADOdb can be set to run VACUUM. If mysql is detected, then optimize database could be called.You can turn this on or off using: | ||
- | <code php> | ||
- | $turnOn = true; # or false | ||
- | ADODB_Session:: | ||
- | </ | ||
- | The default is optimization is disabled. | ||
===== Backwards Compatability ===== | ===== Backwards Compatability ===== |
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad