Functions

include/inc.db_session_handler.php File Reference

Go to the source code of this file.

Functions

 db_session_open ($save_path, $name)
 Database Session Handling.
 db_session_close ()
 close session
 db_session_read ($session_id)
 db_session_write ($session_id, $data)
 Writes serialized session data to the database.
 db_session_destroy ($session_id)
 destroy session
 db_session_gc ($gc_maxlifetime)
 removes sessions that weren't updated for more than gc_maxlifetime seconds
 db_set_save_handler ()

Function Documentation

db_session_close (  ) 

close session

for a db nothing has to be done here

Definition at line 53 of file inc.db_session_handler.php.

{
        return true;
}    

db_session_destroy ( session_id  ) 

destroy session

Parameters:
integer $session_id session id

Definition at line 101 of file inc.db_session_handler.php.

References $q.

{
        global $ilDB;

        $q = "DELETE FROM usr_session WHERE session_id = '".addslashes($session_id)."'";
        $ilDB->query($q);
  
        return true;
}

db_session_gc ( gc_maxlifetime  ) 

removes sessions that weren't updated for more than gc_maxlifetime seconds

Parameters:
integer $gc_maxlifetime max lifetime in seconds

Definition at line 117 of file inc.db_session_handler.php.

References $q.

{
        global $pear_session_db,$ilDB;

        $q = "DELETE FROM usr_session WHERE expires < ".time();
        $ilDB->query($q);
        
        return true;
}

db_session_open ( save_path,
name 
)

Database Session Handling.

inc.db_session_handler.php iliascore

Version:
Id:
inc.db_session_handler.php 12583 2006-11-21 14:10:14Z akill

Definition at line 43 of file inc.db_session_handler.php.

{
        return true;
}

db_session_read ( session_id  ) 

Definition at line 65 of file inc.db_session_handler.php.

References $data, and $q.

{
        global $ilDB;

        $q = "SELECT data FROM usr_session WHERE session_id = '".addslashes($session_id)."'";
        $r = $ilDB->query($q);
        $data = $r->fetchRow(DB_FETCHMODE_ASSOC);

        return $data["data"];
}

db_session_write ( session_id,
data 
)

Writes serialized session data to the database.

Parameters:
integer $session_id session id
string $data session data

Definition at line 82 of file inc.db_session_handler.php.

References $_SESSION, $data, $q, and ilUtil::prepareDBString().

Referenced by ilRbacSystem::saveAccessStatus().

{
        global $pear_session_db,$ilDB;

        //var_dump("<pre>",session_decode($data),"</pre>");exit;
        $expires = time() + ini_get("session.gc_maxlifetime");
        $q = "REPLACE INTO usr_session (session_id, expires, data, ctime,user_id) ".
                 "VALUES('".ilUtil::prepareDBString($session_id)."','".$expires."','".ilUtil::prepareDBString($data).
                 "','".time()."','".$_SESSION["AccountId"]."')";
        $ilDB->query($q);        

        return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

db_set_save_handler (  ) 

Definition at line 132 of file inc.db_session_handler.php.

Referenced by ilBaseAuthentication::__setSessionSaveHandler(), ilPasswordAssistanceGUI::sendPasswordAssistanceMail(), and ilInitialisation::setSessionHandler().

{
        // register save handler functions
        if (ini_get("session.save_handler") == "user")
        {
                session_set_save_handler(
                        "db_session_open",
                        "db_session_close",
                        "db_session_read",
                        "db_session_write",
                        "db_session_destroy",
                        "db_session_gc");
                        
                        return true;
        }
        
        return false;
}

Here is the caller graph for this function: