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:17] – mnewnham | v5:session:session_index [2019/11/26 23:50] – [Backwards Compatibility] mnewnham | ||
---|---|---|---|
Line 3: | Line 3: | ||
<WRAP right box> | <WRAP right box> | ||
[[v5: | [[v5: | ||
- | [[v5: | + | [[v5: |
</ | </ | ||
Line 24: | Line 24: | ||
An alternative to using a database backed session handler is to use [[v5: | An alternative to using a database backed session handler is to use [[v5: | ||
+ | ===== Driver Support ===== | ||
+ | The following drivers are known to work with the adodb-session2.php file: | ||
+ | - mysqli | ||
+ | - pdo_mysqli (From ADOdb version 5.21) | ||
+ | - postgres | ||
+ | - oci8 | ||
+ | |||
+ | This is not an exhaustive list, if you are using the system with a different database, let us know so we can add it to the list. | ||
===== Usage ===== | ===== Usage ===== | ||
Line 87: | Line 95: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | ADOdb_session::Persist($connectMode=false); | + | ADOdb_Session::persist($connectMode=false); |
session_start(); | session_start(); | ||
Line 101: | Line 109: | ||
</ | </ | ||
- | The parameter to the '' | ||
- | |||
- | ^$connectMode^Connection Method^ | ||
- | ^true|PConnect()| | ||
- | ^false|Connect()| | ||
- | ^' | ||
- | ^' | ||
- | ^' | ||
<WRAP important> | <WRAP important> | ||
The original session management routines that use '' | The original session management routines that use '' | ||
Line 124: | Line 124: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | adodb_sess_open(false, | ||
session_start(); | session_start(); | ||
</ | </ | ||
Line 139: | Line 138: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | adodb_sess_open(false, | ||
session_start(); | session_start(); | ||
</ | </ | ||
Line 147: | Line 145: | ||
Create this table in your database. | Create this table in your database. | ||
- | ==== MySQL ==== | + | ==== MySQL or PDO MySQL ==== |
| | ||
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 228: | Line 226: | ||
$user = $ADODB_SESS_CONN-> | $user = $ADODB_SESS_CONN-> | ||
- | $ADODB_SESS_CONN-> | + | $ADODB_SESS_CONN-> |
system(" | system(" | ||
} | } | ||
Line 267: | Line 265: | ||
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 | + | ===== Backwards |
The older method of connecting to ADOdb using global variables is now deprecated, and **will be removed** in ADOdb version 6.0: | The older method of connecting to ADOdb using global variables is now deprecated, and **will be removed** in ADOdb version 6.0: | ||
Line 306: | Line 276: | ||
$ADODB_SESSION_USER =' | $ADODB_SESSION_USER =' | ||
$ADODB_SESSION_PWD =' | $ADODB_SESSION_PWD =' | ||
- | $ADODB_SESSION_DB ='phplens'; | + | $ADODB_SESSION_DB ='employees'; |
include ' | include ' |
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad