当前位置: 首页>>代码示例>>PHP>>正文


PHP logout函数代码示例

本文整理汇总了PHP中logout函数的典型用法代码示例。如果您正苦于以下问题:PHP logout函数的具体用法?PHP logout怎么用?PHP logout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Main

function Main()
{
    global $TPLV, $bottom, $db, $migalha, $usuario;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        default:
        case 'restrito':
            if ($usuario->isLogado()) {
                inicio();
            } else {
                restrito();
            }
            break;
        case 'inicio':
            inicio();
            break;
        case 'logout':
            logout();
            break;
    }
}
开发者ID:rodrigopluz,项目名称:mvc,代码行数:28,代码来源:login.php

示例2: logout

 static function logout($input)
 {
     $result = logout();
     if (!$result) {
         throw new Exception("could_not_logout");
     }
 }
开发者ID:pleio,项目名称:rijkshuisstijl,代码行数:7,代码来源:Mutations.php

示例3: LoginUser

function LoginUser($tool_provider)
{
    // Clear any existing sessions
    if (elgg_is_logged_in()) {
        logout();
    }
    $values = GetPluginSettings();
    $userprovision = $values['userprovision'];
    $user_id = $tool_provider->user->getID(BasicLTI_Tool_Provider::ID_SCOPE_GLOBAL);
    $consumer_key = $tool_provider->consumer->guid;
    $context_id = $tool_provider->user->context->id;
    // Does user exist
    $user = CheckLTIUser($user_id);
    // Provision user, if on and needed
    if (empty($user)) {
        if ($userprovision) {
            $user = CreateLTIUser($consumer_key, $context_id, $tool_provider->user);
            if (empty($user)) {
                forward();
            }
        } else {
            system_message(elgg_echo('LTI:info:noprovision'));
            forward();
            exit;
        }
    }
    // Set up current context id
    $user->context_id = $context_id;
    $user->email = $tool_provider->user->email;
    $user->name = $tool_provider->user->fullname;
    $user->save();
    // Login
    $result = login($user, false);
    return $result;
}
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:35,代码来源:LTIUser.php

示例4: check_login

function check_login()
{
    // If session does not exist on server side, or IP address has changed, or session has expired, show login screen.
    if (!isset($_SESSION['uid']) || !$_SESSION['uid'] || $_SESSION['ip'] != allIPs() || time() >= $_SESSION['expires_on']) {
        logout();
    }
    $_SESSION['expires_on'] = time() + INACTIVITY_TIMEOUT;
    // User accessed a page : Update his/her session expiration date.
    // Tracabilité LOG
    $dbconn = pg_connect(CONFIG_DB) or die('Connexion impossible : ' . pg_last_error());
    $numero_ID = $_SESSION['numero_abo'];
    if ($_SESSION['username'] != 'beprev') {
        $today = new DateTime('now');
        $horodate = date_format($today, 'Y-m-d H:i:s');
        $req = 'SELECT MAX("ID") from user_log;';
        $result = pg_query($req) or die('Échec de la requête : ' . pg_last_error());
        $table = pg_fetch_row($result);
        $Id = $table[0];
        if (strlen($Id) == 0) {
            $Id = 0;
        }
        $Id = $Id + 1;
        $page = $_SESSION["ipFrontOffice"] . $_SERVER['PHP_SELF'];
        $req = "INSERT INTO user_log (\"ID\", id_user,page,horodate) VALUES ('{$Id}','{$numero_ID}','{$page}','{$horodate}');";
        $result = pg_query($req) or die('Échec de la requête : ' . pg_last_error());
    }
    pg_close($dbconn);
}
开发者ID:pierreleplatois,项目名称:sialab,代码行数:28,代码来源:sessionSAVE.php

示例5: reset_db

function reset_db()
{
    global $dbname;
    global $dblocation;
    global $dbpassword;
    global $dbuser;
    global $reset_complete;
    global $error_message;
    $db_connected = false;
    try {
        $mysqli = new mysqli($dblocation, $dbuser, $dbpassword, $dbname);
        if ($mysqli->connect_errno) {
            $error_message = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") Check your setting in the Config.php file.  " . $mysqli->connect_error;
        }
        $db_connected = True;
    } catch (mysqli_sql_exception $e) {
        $error_message = "Check your settings in the Config.php file.<br /><br />  Failed to connect to MySQL.  " . $e;
    }
    if ($db_connected) {
        $command = "mysql --user=" . $dbuser . " --password=" . $dbpassword . " --database=" . $dbname . " < ./db-scripts/ResetDB.sql";
        $output = shell_exec($command);
        echo $output;
        $reset_complete = True;
        logout();
    }
}
开发者ID:saltycoder,项目名称:wipl,代码行数:26,代码来源:Reset.php

示例6: onPost

function onPost()
{
    if (!isset($_POST['method'])) {
        http_response_code(HTTP_BAD_REQUEST);
        echo 'method field reuired';
        return;
    }
    switch ($_POST['method']) {
        case METHOD_LOGIN:
            login();
            break;
        case METHOD_LOGOUT:
            logout();
            break;
        case METHOD_CREATE_ACCOUNT:
            createAccount();
            break;
        case METHOD_USER_INFO:
            userInfo();
            break;
        default:
            http_response_code(HTTP_BAD_REQUEST);
            echo 'invalid method name: ' . $_POST['method'];
            return;
    }
}
开发者ID:JoshuaRichards,项目名称:php-todo,代码行数:26,代码来源:user.php

示例7: main

function main() {

    global $auth;

    if ($_REQUEST['action'] == 'delete' && $auth){
        delete();
    }
    elseif ($_REQUEST['action'] == 'list' && $auth){
        view_list();
    }
    elseif ($_REQUEST['action'] == 'banip' && $auth){
        banip();
    }
    elseif ($_REQUEST['action'] == 'search' && $auth){
        search();
    }
    elseif ($_REQUEST['action'] == 'bannedlist' && $auth){
        bannedlist();
    }
    elseif ($_REQUEST['action'] == 'unbanip' && $auth){
        unbanip();
    }
    elseif ($_REQUEST['action'] == 'logout'){
        logout();
    }
    elseif (1) {
        login_screen();
    }

}
开发者ID:neutyp,项目名称:commenter,代码行数:30,代码来源:admin.php

示例8: routing

/**
 * routing
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Center
 * @author Henry Ruhs
 */
function routing()
{
    /* check token */
    if ($_POST && $_POST['token'] != TOKEN) {
        notification(l('error_occurred'), l('token_incorrect'), l('home'), ROOT);
        return;
    }
    /* call default post */
    $post_list = array('comment', 'login', 'password_reset', 'registration', 'reminder', 'search');
    foreach ($post_list as $value) {
        if ($_POST[$value . '_post'] && function_exists($value . '_post')) {
            call_user_func($value . '_post');
            return;
        }
    }
    /* general routing */
    switch (FIRST_PARAMETER) {
        case 'admin':
            if (LOGGED_IN == TOKEN) {
                admin_routing();
            } else {
                notification(l('error_occurred'), l('access_no'), l('login'), 'login');
            }
            return;
        case 'login':
            login_form();
            return;
        case 'logout':
            if (LOGGED_IN == TOKEN) {
                logout();
            } else {
                notification(l('error_occurred'), l('access_no'), l('login'), 'login');
            }
            return;
        case 'password_reset':
            if (s('reminder') == 1 && FIRST_SUB_PARAMETER && THIRD_PARAMETER) {
                password_reset_form();
            } else {
                notification(l('error_occurred'), l('access_no'), l('home'), ROOT);
            }
            return;
        case 'registration':
            if (s('registration')) {
                registration_form();
            } else {
                notification(l('error_occurred'), l('access_no'), l('home'), ROOT);
            }
            return;
        case 'reminder':
            if (s('reminder') == 1) {
                reminder_form();
            } else {
                notification(l('error_occurred'), l('access_no'), l('home'), ROOT);
            }
            return;
        default:
            contents();
            return;
    }
}
开发者ID:ITw3,项目名称:redaxscript,代码行数:70,代码来源:center.php

示例9: user_delete

function user_delete($username_to_delete)
{
    if (!$username_to_delete) {
        redirect('/');
    }
    if (($username_to_delete == $_SERVER['USER'] || user_is_administrator()) && user_is_valid($_SERVER['USERINFO_ARRAY']['username'], $_SERVER['USERINFO_ARRAY']['userpass'])) {
        $userdir = "{$_SERVER['PWUSERS_DIR']}/{$username_to_delete}";
        exec("rm -fR {$userdir}", $delresults);
        exec("grep -rli {$username_to_delete} {$_SERVER['PWUSERS_DIR']}/*/watchedlist.txt", $watchedlists);
        foreach ($watchedlists as $watched) {
            $data = file_get_contents($watched);
            if (strstr($data, "!{$planowner}")) {
                preg_match("|(!{$planowner}.*!)|", $data, $matches);
                $remove = $matches[0];
            } else {
                $remove = "\n{$planowner}\n";
            }
            // remove whatever we found
            $data = str_replace($remove, '', $data);
            // break down multiple linebreaks so the list doesn't look weird in the edit view
            $data = str_replace("\n\n", "\n", $data);
            file_put_contents($watched, $data);
        }
    } else {
        output("Error deleting {$username_to_delete}", "\n\t<div class='alert'>\n\tYou can't delete {$username_to_delete}. Talk to an\n\t<a href='mailto:help@planwatch.org'>admin</a>.\n\tClick <a href='{$_SERVER['WEB_ROOT']}/'>here</a> to go back to the main page.\n\t</div>\n\t");
    }
    if ($username_to_delete == $user) {
        logout("{$username_to_delete} has been deleted.");
    } else {
        redirect('/');
    }
}
开发者ID:joshuawdavidson,项目名称:planwatch,代码行数:32,代码来源:users.php

示例10: page_protect

function page_protect()
{
    session_start();
    global $db;
    if (isset($_SESSION['HTTP_USER_AGENT'])) {
        if ($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT'])) {
            logout();
            exit;
        }
    }
    if (!isset($_SESSION['user_id']) && !isset($_SESSION['user_name'])) {
        if (isset($_COOKIE['user_id']) && isset($_COOKIE['user_key'])) {
            $cookie_user_id = filter($_COOKIE['user_id']);
            $rs_ctime = mysql_query("select `ckey`,`ctime` from `users` where `id` ='{$cookie_user_id}'") or die(mysql_error());
            list($ckey, $ctime) = mysql_fetch_row($rs_ctime);
            if (time() - $ctime > 60 * 60 * 24 * COOKIE_TIME_OUT) {
                logout();
            }
            if (!empty($ckey) && is_numeric($_COOKIE['user_id']) && isUserID($_COOKIE['user_name']) && $_COOKIE['user_key'] == sha1($ckey)) {
                session_regenerate_id();
                //against session fixation attacks.
                $_SESSION['user_id'] = $_COOKIE['user_id'];
                $_SESSION['user_name'] = $_COOKIE['user_name'];
                list($user_level) = mysql_fetch_row(mysql_query("select user_level from users where id='{$_SESSION['user_id']}'"));
                $_SESSION['user_level'] = $user_level;
                $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']);
            } else {
                logout();
            }
        } else {
            header("Location: login.php");
            exit;
        }
    }
}
开发者ID:kbeadl,项目名称:FandomBrain,代码行数:35,代码来源:dbc.php

示例11: loginOut

 public function loginOut()
 {
     //退出时清除session
     logout();
     savePermissionIDEliminate();
     savePermissionURLEliminate();
     $this->success('退出成功!', U('checkLogin'));
 }
开发者ID:JunchunOne,项目名称:shop_1,代码行数:8,代码来源:LoginController.class.php

示例12: checkAccess

function checkAccess()
{
    if (!isUserAuth()) {
        logout();
        //Ensure user does not receive sensitive content 4.4.3
        die("Unauthorized access");
    }
}
开发者ID:efdalustaoglu,项目名称:secure-coding,代码行数:8,代码来源:user.php

示例13: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		logout();

		$system->triggerEventIntern("logout", array());
		$stdout = ucf(i18n("logout successfull"));
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:8,代码来源:logout.php

示例14: deleteUser

function deleteUser()
{
    $user = new User();
    $user->deleteUser($_POST['usr_id']);
    if (isset($_SESSION['id']) && $_SESSION['id'] == $_POST['usr_id']) {
        logout();
    }
}
开发者ID:neequole,项目名称:sp2,代码行数:8,代码来源:userFunc.php

示例15: validate_xsrf_token

function validate_xsrf_token($token)
{
    if ($token != $_SESSION[CONST_XSRF_TOKEN_KEY]) {
        log_exception(new Exception('Invalid XSRF token. Was: "' . $token . '". Wanted: "' . $_SESSION[CONST_XSRF_TOKEN_KEY] . '"'));
        logout();
        exit;
    }
}
开发者ID:HackMiami,项目名称:mellivora,代码行数:8,代码来源:xsrf.inc.php


注:本文中的logout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。