Ejemplo n.º 1
0
function reset_user()
{
    $_SESSION['generated'] = microtime(TRUE);
    $_SESSION['SALT'] = SALT;
    $_SESSION['user'] = array('site_state' => 0, 'user_group' => 'anonymous', 'view' => 'login', 'template' => 'default', 'color_scheme' => 'default', 'media' => 'screen');
    $_SESSION['accesstime'] = microtime(TRUE);
    setcookie('SESSION_TOKEN', session_token(), $_SESSION['generated'] + SESSION_VALID, '/', $_SERVER['SERVER_NAME'], FALSE, TRUE);
    // this cookie stores session token. Session id is stored under a cookie with the name defined in settings.ini
}
Ejemplo n.º 2
0
        }
        // end switch ( $_POST['action'] )
    }
}
/*
* 7.0 Output view 
*/
echo $presentation;
session_write_close();
/*
* 8.0 Serialize view if allowed to 
*/
try {
    if ($presentation->cache_allowed) {
        /* if new view was created, then use 'INSERT' query. Use 'UPDATE' if viwe was unserialized (view record already exists) */
        $params = array(0 => array(':session_id', $session_id, PDO::PARAM_STR), 1 => array(':session_token', session_token(), PDO::PARAM_STR), 2 => array(':data', serialize($presentation), PDO::PARAM_STR), 3 => array(':ttl', CACHE_TIME, PDO::PARAM_INT));
        if ($view_regen) {
            // delete former cached view(s) from session_cache
            $query[3]->bindParam(':session_id', $session_id, PDO::PARAM_STR);
            $query[3]->execute();
            /* insert view into session_cache table */
            bind_params($params, $query[5]);
            if (!$query[5]->execute()) {
                error_log(sprintf($warnings['18'], $_SESSION['user']['view'], $session_id));
            }
        } else {
            /* update view in the session_cache table */
            $params[] = array(':id', $result[2]['id'], PDO::PARAM_INT);
            // this is done bc session_token is not primary key, id is and UPDATE statement needs to update by primary key
            bind_params($params, $query[4]);
            if (!$query[4]->execute()) {