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/16 02:16] mnewnhamv5:session:session_index [2016/05/22 17:21] mnewnham
Line 1: Line 1:
 +====== Session Management ======
 +~~NOTOC~~
 <WRAP right box> <WRAP right box>
 [[v5:session:Index]]\\ [[v5:session:Index]]\\
-[[v5:session:reference:index|Session Command Reference +[[v5:session:reference:index|Session Command Reference]]\\
-</WRAP> +
-====== Session Management ====== +
-<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> </WRAP>
 +
 ===== 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 102: Line 101:
 </code> </code>
  
-The parameter to the ''persist( )'' method sets the connection modeYou can pass the following: +<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]] 
-^$connectMode^Connection Method^ +</WRAP>
-^true|PConnect()| +
-^false|Connect()| +
-^'N'|NConnect()| +
-^'P'|PConnect()| +
-^'C'|Connect()+
 ===== 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 123: Line 116:
  
 ADOdb_Session::config($driver, $host, $user, $password, $database,$options=false); ADOdb_Session::config($driver, $host, $user, $password, $database,$options=false);
-adodb_sess_open(false,false,$connectMode=false); 
 session_start(); session_start();
 </code> </code>
Line 138: Line 130:
  
 ADOdb_Session::config($driver, $host, $user, $password, $database,$options=false); ADOdb_Session::config($driver, $host, $user, $password, $database,$options=false);
-adodb_sess_open(false,false,$connectMode=false); 
 session_start(); session_start();
 </code> </code>
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 ''adodb_session_regenerate_id()'' will dynamically change the current session id with a newly generated one and update database. This currently only works with cookies. Useful to improve security by reducing the risk of session-hijacking. See this article on Session Fixation for more info on the theory behind this feature.  
- 
-==== Usage ==== 
- 
-<code php> 
-include 'adodb/adodb-session2.php'; 
- 
-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(); 
-</code> 
  
-This function calls ''session_regenerate_id()'' internally or simulates it if the function does not exist. 
  
 ===== Vacuum/Optimize Database ===== ===== Vacuum/Optimize Database =====
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad