/** * Performs actions needed on session timeout */ function do_session_timeout() { $cfg = EasySCP_Registry::get('Config'); $sql_param = array(':lastaccess' => time() - $cfg->SESSION_TIMEOUT * 60); $sql_query = "\n\t\tDELETE FROM\n\t\t\tlogin\n\t\tWHERE\n\t\t\tlastaccess < :lastaccess\n\t"; DB::prepare($sql_query); DB::execute($sql_param)->closeCursor(); if (!session_exists(session_id())) { unset($_SESSION['user_logged']); unset_user_login_data(); } }
function session_restore_messages() { if (!session_exists()) { return false; } $messages = session_get('wfpl_messages'); if ($messages !== false) { $messages = string_to_array($messages); if (!(isset($GLOBALS['wfpl_messages']) && is_array($GLOBALS['wfpl_messages']))) { $GLOBALS['wfpl_messages'] = array(); } # messages from the previous run happened first $GLOBALS['wfpl_messages'] = array_merge($messages, $GLOBALS['wfpl_messages']); } session_clear('wfpl_messages'); }
/** --------------------------------- * * User Helper Functions * * --------------------------------- **/ function is_loggedin() { global $_config; return session_exists($_config['session_id']) && array_key_exists('user', $_SESSION[$_config['session_id']]); }
function init_session() { if (!session_exists()) { session_new(); } }
/** * Remove a session key to the * current session */ function session_remove($key) { if (session_exists($key)) { unset($_SESSION[$key]); } }