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
Next revisionBoth sides next revision
v5:session:session_index [2016/05/22 17:23] – [Vacuum/Optimize Database] mnewnhamv5:session:session_index [2018/07/24 01:07] – [Introduction] mnewnham
Line 24: Line 24:
 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.
  
 +===== 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::config($driver, $host, $user, $password, $database, $options=false); ADOdb_Session::config($driver, $host, $user, $password, $database, $options=false);
-ADOdb_session::Persist($connectMode=false);+ADOdb_Session::persist($connectMode=false);
 session_start(); session_start();
  
Line 137: 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 '',
-    expiry DATETIME NOT NULL ,+   expiry DATETIME NOT NULL ,
    expireref VARCHAR( 250 ) DEFAULT '',    expireref VARCHAR( 250 ) DEFAULT '',
    created DATETIME NOT NULL ,    created DATETIME NOT NULL ,
Line 218: Line 226:
  $user = $ADODB_SESS_CONN->qstr($expireref);  $user = $ADODB_SESS_CONN->qstr($expireref);
  
- $ADODB_SESS_CONN->Execute("delete from shopping_cart where user=$user");+ $ADODB_SESS_CONN->execute("delete from shopping_cart where user=$user");
  system("rm /work/tmpfiles/$expireref/*");  system("rm /work/tmpfiles/$expireref/*");
 } }
Line 260: Line 268:
  
  
-===== Backwards Compatability =====+===== Backwards Compatibility =====
  
 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:
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad