Ejemplo n.º 1
0
 /**
  * Start the session
  */
 public static function startSession()
 {
     require_once 'HTTP/Session2.php';
     $user_id = TIP::getUserId();
     if ($user_id) {
         // For a logged in user, use the special TIP container
         HTTP_Session2::useCookies(false);
         HTTP_Session2::setContainer('TIP');
         HTTP_Session2::start('TIP_Session', $user_id);
     } else {
         // For anonymous users, cookie with an automatic session id is used
         HTTP_Session2::useCookies(true);
         HTTP_Session2::start('TIP_Session');
     }
     HTTP_Session2::setExpire(time() + 3600 * 4);
     if (HTTP_Session2::isExpired()) {
         HTTP_Session2::destroy();
         TIP::notifyInfo('session');
     }
 }
Ejemplo n.º 2
0
     include_once dirname(__FILE__) . '/bcadd.php';
 }
 // ************ HANDLERS AND OTHER MODULE LOADERS ****************
 include_once dirname(__FILE__) . "/loader.php";
 include_once dirname(__FILE__) . "/module.php";
 // ****************** INITIALIZE SQL CONNECTION ******************
 define('DB_ENGINE', 'mysqli');
 //----- Create SQL database object
 if (!defined('SKIP_SQL_INIT')) {
     $sql = CreateObject('org.freemedsoftware.core.FreemedDb');
 }
 // ********************** START SESSION **************************
 if (!defined('SESSION_DISABLE') and !defined('SKIP_SQL_INIT')) {
     LoadObjectDependency('net.php.pear.HTTP_Session2');
     HTTP_Session2::useTransSID(false);
     HTTP_Session2::useCookies(true);
     // using an existing MDB2 connection
     HTTP_Session2::setContainer('MDB2', array('dsn' => $GLOBALS['sql']->GetMDB2Object(), 'table' => 'session'));
     HTTP_Session2::start();
     HTTP_Session2::setExpire(time() + 60 * 60);
     // set expire to 60 minutes
     HTTP_Session2::setIdle(time() + 10 * 60);
     // set idle to 10 minutes
     if (HTTP_Session2::isExpired()) {
         syslog(LOG_INFO, "Session expired!!");
         HTTP_Session2::destroy();
     }
     if (HTTP_Session2::isIdle()) {
         syslog(LOG_INFO, "Session became idle");
         HTTP_Session2::destroy();
     }