Пример #1
0
/**
* Log user out
*
* This logs the user out of the system and clears all session vars
*
* @return   none    Redirects user to index page
*
*/
function userLogout()
{
    global $_CONF, $_TABLES, $_USER, $_COOKIE;
    if (!empty($_USER['uid']) and $_USER['uid'] > 1) {
        DB_query("UPDATE {$_TABLES['users']} set remote_ip='' WHERE uid=" . $_USER['uid'], 1);
        SESS_endUserSession($_USER['uid']);
        PLG_logoutUser($_USER['uid']);
    }
    SEC_setCookie($_CONF['cookie_session'], '', time() - 10000, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], true);
    SEC_setCookie($_CONF['cookie_password'], '', time() - 10000, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], true);
    SEC_setCookie($_CONF['cookie_name'], '', time() - 10000, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], true);
    if (isset($_COOKIE['token'])) {
        $token = $_COOKIE['token'];
        DB_delete($_TABLES['tokens'], 'token', DB_escapeString($token));
        SEC_setCookie('token', '', time() - 10000, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], true);
    }
    DB_delete($_TABLES['tokens'], 'owner_id', (int) $_USER['uid']);
    echo COM_refresh($_CONF['site_url'] . '/index.php?msg=8');
}
Пример #2
0
    }
    // don't return
    exit;
}
// MAIN
if (isset($_REQUEST['mode'])) {
    $mode = $_REQUEST['mode'];
} else {
    $mode = '';
}
$display = '';
switch ($mode) {
    case 'logout':
        if (!empty($_USER['uid']) && $_USER['uid'] > 1) {
            SESS_endUserSession($_USER['uid']);
            PLG_logoutUser($_USER['uid']);
        }
        SEC_setCookie($_CONF['cookie_session'], '', time() - 10000);
        SEC_setCookie($_CONF['cookie_password'], '', time() - 10000);
        SEC_setCookie($_CONF['cookie_name'], '', time() - 10000);
        COM_redirect($_CONF['site_url'] . '/index.php?msg=8');
        break;
    case 'profile':
        $uid = COM_applyFilter($_GET['uid'], true);
        if (is_numeric($uid) && $uid > 1) {
            $msg = 0;
            if (isset($_GET['msg'])) {
                $msg = COM_applyFilter($_GET['msg'], true);
            }
            $plugin = '';
            if ($msg > 0 && isset($_GET['plugin'])) {