ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:session_index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
v5:session:session_index [2018/07/24 01:07] – [Introduction] mnewnhamv5:session:session_index [2023/03/27 13:14] – [MySQL or PDO MySQL] explain reason for using binary collation dregad
Line 1: Line 1:
 ====== Session Management ====== ====== Session Management ======
-~~NOTOC~~ 
 <WRAP right box> <WRAP right box>
 [[v5:session:Index]]\\ [[v5:session:Index]]\\
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 23: Line 22:
  
 An alternative to using a database backed session handler is to use [[v5:userguide:memcached]]. This is a distributed memory based caching system suitable for storing session information. An alternative to using a database backed session handler is to use [[v5:userguide:memcached]]. This is a distributed memory based caching system suitable for storing session information.
 +
 +<WRAP important>
 +The original session management routines that use ''adodb-session.inc.php'' are deprecated as of ADOdb version 5.20, and will be removed in ADOdb Version 6.0.0. For information on upgrading from the original version, see [[v5:session:version1|Here]]
 +</WRAP>
 +
  
 ===== Driver Support ===== ===== Driver Support =====
Line 109: Line 113:
 </code> </code>
  
-<WRAP important> +
-The original session management routines that use ''adodb-session.inc.php'' are deprecated as of ADOdb version 5.20, and will be removed in ADOdb Version 6.0.0. For information on upgrading from the original version, see [[v5:session:version1|Here]] +
-</WRAP>+
 ===== Using Encrypted Sessions ===== ===== Using Encrypted Sessions =====
 To use a encrypted sessions, replace the file ''adodb-session2.php'' with ''adodb-cryptsession2.php'': To use a encrypted sessions, replace the file ''adodb-session2.php'' with ''adodb-cryptsession2.php'':
Line 146: Line 148:
  
 ==== MySQL or PDO MySQL ==== ==== MySQL or PDO MySQL ====
-   + 
-  CREATE TABLE sessions2( +<code> 
-   sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', +CREATE TABLE sessions2 ( 
-   expiry DATETIME NOT NULL , +  sesskey VARCHAR( 64 ) COLLATE utf8mb4_bin NOT NULL DEFAULT '', 
-   expireref VARCHAR( 250 ) DEFAULT '', +  expiry DATETIME NOT NULL , 
-   created DATETIME NOT NULL , +  expireref VARCHAR( 250 ) DEFAULT '', 
-   modified DATETIME NOT NULL , +  created DATETIME NOT NULL , 
-   sessdata LONGTEXT, +  modified DATETIME NOT NULL , 
-   PRIMARY KEY ( sesskey ) , +  sessdata LONGTEXT, 
-   INDEX sess2_expiry( expiry ), +  PRIMARY KEY ( sesskey ) , 
-   INDEX sess2_expireref( expireref ) +  INDEX sess2_expiry( expiry ), 
-  )+  INDEX sess2_expireref( expireref ) 
 +) 
 +</code> 
 + 
 +<WRAP info> 
 +When [[https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character|session.sid_bits_per_character]] php.ini setting is set to 6, the //Session ID// can contain both upper and lowercase letters.  
 +Collisions could occur in this case, due to MySQL performing case-insensitive searches by default.  
 +To avoid that, the //sesskey// column should use binary (or a case-sensitive) collation. 
 +</WRAP> 
  
 ==== PostgreSQL ==== ==== PostgreSQL ====
Line 276: Line 287:
 $ADODB_SESSION_USER ='root'; $ADODB_SESSION_USER ='root';
 $ADODB_SESSION_PWD ='abc'; $ADODB_SESSION_PWD ='abc';
-$ADODB_SESSION_DB ='phplens';+$ADODB_SESSION_DB ='employees';
  
 include 'adodb/adodb-session.php'; include 'adodb/adodb-session.php';
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad