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
v5:session:session_index [2023/03/27 13:14] – [MySQL or PDO MySQL] explain reason for using binary collation dregadv5:session:session_index [2023/04/08 18:08] (current) – Add WRAPs for notes dregad
Line 206: Line 206:
 ===== Notifications ===== ===== Notifications =====
  
-You can receive notification when your session is cleaned up by the session garbage collector or when you call session_destroy().+You can receive notification when your session is cleaned up by the session garbage collector or when you call //session_destroy()//.
  
-PHP's session extension will automatically run a special garbage collection function based on your php.ini session.cookie_lifetime and session.gc_probability settings. This will in turn call adodb's garbage collection function, which can be setup to do notification.+PHP's session extension will automatically run a special garbage collection function based on your php.ini session.cookie_lifetime and session.gc_probability settings. This will in turn call ADOdb's garbage collection function, which can be setup to perform notification.
  
- PHP Session --> ADOdb Session  --> Find all recs  --> Send          --> Delete queued +  PHP Session --> ADOdb Session --> Find all recs --> Send         --> Delete 
- GC Function     GC Function        to be deleted      notification      records +  GC Function     GC Function       to be deleted     notification     queued 
- executed at     called by                             for all recs +  executed at     called by                           for all recs     records 
- random time     Session Extension                     queued for deletion+  random time     Session                             queued for 
 +                  Extension                           deletion
  
 When a session is created, we need to store a value in the session record (in the EXPIREREF field), typically the userid of the session. Later when the session has expired, just before the record is deleted, we reload the EXPIREREF field and call the notification function with the value of EXPIREREF, which is the userid of the person being logged off. When a session is created, we need to store a value in the session record (in the EXPIREREF field), typically the userid of the session. Later when the session has expired, just before the record is deleted, we reload the EXPIREREF field and call the notification function with the value of EXPIREREF, which is the userid of the person being logged off.
Line 240: Line 241:
  system("rm /work/tmpfiles/$expireref/*");  system("rm /work/tmpfiles/$expireref/*");
 } }
-</code>    +</code> 
-NOTE 1: If you have register_globals disabled in php.ini, then you will have to manually set the EXPIREREFe.g.+ 
 +<WRAP info> 
 +EXPIREREF must be set manually, e.g. 
  
 <code php> <code php>
Line 248: Line 251:
 </code> </code>
  
-NOTE 2: If you want to change the EXPIREREF after the session record has been created, you will need to modify any session variable to force a database record update.+In older versions of ADOdb this could be achieved automatically through the use of register_globals, but this feature has been [[https://php-legacy-docs.zend.com/manual/php5/en/security.globals|removed in PHP 5.4 for security reasons]]. 
 +</WRAP>
  
 +<WRAP info>
 +If you want to change the EXPIREREF after the session record has been created, you will need to modify any session variable to force a database record update.
 +</WRAP>
 ===== Neat Notification Tricks =====  ===== Neat Notification Tricks ===== 
  
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad