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/22 17:23] – [Vacuum/Optimize Database] mnewnham | v5:session:session_index [2023/03/27 13:02] – [MySQL or PDO MySQL] create table with binary collation dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Session Management ====== | ====== Session Management ====== | ||
- | ~~NOTOC~~ | ||
<WRAP right box> | <WRAP right box> | ||
[[v5: | [[v5: | ||
Line 9: | Line 8: | ||
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 | ||
- | * Simplified clean-up at end =of session life | + | * Simplified clean-up at end of session life |
* Easy analysis of session data | * Easy analysis of session data | ||
* Simple session termination | * Simple session termination | ||
Line 24: | Line 23: | ||
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: | ||
+ | <WRAP important> | ||
+ | The original session management routines that use '' | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== 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 99: | ||
ADOdb_Session:: | ADOdb_Session:: | ||
- | ADOdb_session::Persist($connectMode=false); | + | ADOdb_Session::persist($connectMode=false); |
session_start(); | session_start(); | ||
Line 101: | Line 113: | ||
</ | </ | ||
- | <WRAP important> | + | |
- | The original session management routines that use '' | + | |
- | </ | + | |
===== Using Encrypted Sessions ===== | ===== Using Encrypted Sessions ===== | ||
To use a encrypted sessions, replace the file '' | To use a encrypted sessions, replace the file '' | ||
Line 137: | Line 147: | ||
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 ) COLLATE utf8mb4_bin |
- | | + | expiry DATETIME NOT NULL , |
- | | + | expireref VARCHAR( 250 ) DEFAULT '', |
- | | + | created DATETIME NOT NULL , |
- | | + | modified DATETIME NOT NULL , |
- | | + | sessdata LONGTEXT, |
- | | + | PRIMARY KEY ( sesskey ) , |
- | | + | INDEX sess2_expiry( expiry ), |
- | ) | + | INDEX sess2_expireref( expireref ) |
+ | ) | ||
+ | </ | ||
==== PostgreSQL ==== | ==== PostgreSQL ==== | ||
Line 218: | Line 230: | ||
$user = $ADODB_SESS_CONN-> | $user = $ADODB_SESS_CONN-> | ||
- | $ADODB_SESS_CONN-> | + | $ADODB_SESS_CONN-> |
system(" | system(" | ||
} | } | ||
Line 260: | Line 272: | ||
- | ===== 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 268: | Line 280: | ||
$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