本文整理汇总了PHP中Logout函数的典型用法代码示例。如果您正苦于以下问题:PHP Logout函数的具体用法?PHP Logout怎么用?PHP Logout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Logout函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Error
function Error($text)
{
global $GlobalUser;
if (!$GlobalUser) {
$GlobalUser = array();
$GlobalUser['player_id'] = 0;
}
$text = str_replace('\\"', """, $text);
$text = str_replace('\'', "’", $text);
$text = str_replace('\\`', "‘", $text);
$now = time();
$error = array(null, $GlobalUser['player_id'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['REQUEST_URI'], $text, $now);
$id = AddDBRow($error, 'errors');
Logout($_GET['session']);
// Завершить сессию.
ob_clean();
// Отменить предыдущий HTML.
PageHeader("error", true, false);
echo "<center><font size=\"3\"><b>\n";
echo "<br /><br />\n";
echo "<font color=\"#FF0000\">Произошла ошибка</font> - {$text}\n";
echo "<br /><br />\n";
echo BackTrace() . "<br /><br />\n";
echo "Аварийное завершение программы.<br/><br/>Обратитесь в Службу поддержки или на форум, в раздел \"Ошибки\".\n";
echo "<br /><br />\n";
echo "Error-ID: {$id}</b></font></center>\n";
//PageFooter ();
ob_end_flush();
exit;
}
示例2: FacebookLogin
function FacebookLogin($url)
{
Logout();
global $facebook;
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
$facebookId = $user_profile['id'];
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
$loginInfo = DBFacebookUserLogin($facebookId);
if ($loginInfo['ErrorCode'] == 0) {
$_SESSION['UserID'] = $loginInfo['UserID'];
$_SESSION['Email'] = $loginInfo['Email'];
$_SESSION['UserName'] = $loginInfo['UserName'];
$_SESSION['UserLevel'] = $loginInfo['UserLevel'];
$_SESSION['IsFacebookUser'] = 1;
$result['ResultCode'] = 0;
$result['ResultMessage'] = 'Login Successful';
header('Location: ' . $url);
} else {
$result['ResultCode'] = $loginInfo['ErrorCode'];
$result['ResultMessage'] = $loginInfo['ErrorMessage'];
FacebookSignUp($url);
}
//header('Location: ../#!/');
}
示例3: Login
function Login($username, $password)
{
$this->ulogin->Authenticate($username, $password);
if ($this->ulogin->IsAuthSuccess()) {
$user = $this->userDataAccessor->GetUserById($username);
if ($user->userName == $username) {
$_SESSION['HR'] = $user->isHR;
} else {
Logout();
return false;
}
$_SESSION['uid'] = $this->ulogin->Uid();
$_SESSION['loggedIn'] = true;
return true;
} else {
return false;
}
}
示例4: switch
}
switch ($action) {
case 'login':
if ($zbp->user->ID > 0 && GetVars('redirect', 'GET')) {
Redirect(GetVars('redirect', 'GET'));
}
if ($zbp->CheckRights('admin')) {
Redirect('cmd.php?act=admin');
}
if ($zbp->user->ID == 0 && GetVars('redirect', 'GET')) {
setcookie("redirect", GetVars('redirect', 'GET'), 0, $zbp->cookiespath);
}
Redirect('login.php');
break;
case 'logout':
Logout();
Redirect('../');
break;
case 'admin':
Redirect('admin/?act=admin');
break;
case 'verify':
if (VerifyLogin()) {
if ($zbp->user->ID > 0 && GetVars('redirect', 'COOKIE')) {
Redirect(GetVars('redirect', 'COOKIE'));
}
Redirect('admin/?act=admin');
} else {
Redirect('../');
}
break;
示例5: GetPlanet
<?php
// Выход
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
Logout($_GET['session']);
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<?php
echo hostname();
?>
evolution/formate.css" />
<meta http-equiv="refresh" content="3;URL=index.php" />
<title>Logout</title>
</head>
<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' >
<center>
До скорого!!<br />
<p>
</p>
</center>
</body>
</html>
示例6: is_not_banned
//.........这里部分代码省略.........
}
}
}
}
$smcFunc['db_free_result']($request);
}
// Mark the cannot_access and cannot_post bans as being 'hit'.
if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login'])) {
log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
}
// If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
if ($user_info['id'] && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
require_once $sourcedir . '/ManageBans.php';
updateBanMembers();
}
}
// Hey, I know you! You're ehm...
if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
$bans = explode(',', $_COOKIE[$cookiename . '_']);
foreach ($bans as $key => $value) {
$bans[$key] = (int) $value;
}
$request = $smcFunc['db_query']('', '
SELECT bi.id_ban, bg.reason
FROM {db_prefix}ban_items AS bi
INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group)
WHERE bi.id_ban IN ({array_int:ban_list})
AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})
AND bg.cannot_access = {int:cannot_access}
LIMIT ' . count($bans), array('cannot_access' => 1, 'ban_list' => $bans, 'current_time' => time()));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$_SESSION['ban']['cannot_access']['ids'][] = $row['id_ban'];
$_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
}
$smcFunc['db_free_result']($request);
// My mistake. Next time better.
if (!isset($_SESSION['ban']['cannot_access'])) {
require_once $sourcedir . '/Subs-Auth.php';
$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], 0);
}
}
// If you're fully banned, it's end of the story for you.
if (isset($_SESSION['ban']['cannot_access'])) {
// We don't wanna see you!
if (!$user_info['is_guest']) {
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_online
WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
}
// 'Log' the user out. Can't have any funny business... (save the name!)
$old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
$user_info['name'] = '';
$user_info['username'] = '';
$user_info['is_guest'] = true;
$user_info['is_admin'] = false;
$user_info['permissions'] = array();
$user_info['id'] = 0;
$context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
// A goodbye present.
require_once $sourcedir . '/Subs-Auth.php';
$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], 0);
// Don't scare anyone, now.
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// You banned, sucka!
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');
// If we get here, something's gone wrong.... but let's try anyway.
trigger_error('Hacking attempt...', E_USER_ERROR);
} elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
// We don't wanna see you!
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_online
WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
// 'Log' the user out. Can't have any funny business... (save the name!)
$old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
$user_info['name'] = '';
$user_info['username'] = '';
$user_info['is_guest'] = true;
$user_info['is_admin'] = false;
$user_info['permissions'] = array();
$user_info['id'] = 0;
$context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
// SMF's Wipe 'n Clean(r) erases all traces.
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
require_once $sourcedir . '/LogInOut.php';
Logout(true, false);
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_login']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_login']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br />' . $txt['ban_continue_browse'], 'user');
}
// Fix up the banning permissions.
if (isset($user_info['permissions'])) {
banPermissions();
}
}
示例7: Pad_Logout
function Pad_Logout()
{
Logout();
Redirect('?mod=pad');
die;
}
示例8: loca
if (strlen($_POST['newpass1']) < 8) {
$OptionsError = loca("OPTIONS_ERR_PASS_8");
} else {
if ($GlobalUser['password'] !== md5($_POST['db_password'] . $db_secret)) {
$OptionsError = loca("OPTIONS_ERR_OLDPASS");
}
}
}
}
if ($OptionsError === "") {
$md5 = md5($_POST['newpass1'] . $db_secret);
$query = "UPDATE " . $db_prefix . "users SET password = '" . $md5 . "' WHERE player_id = " . intval($GlobalUser['player_id']);
dbquery($query);
$OptionsError = loca("OPTIONS_MSG_PASS");
// TODO: OPTIONS_MSG_UNSAFE, OPTIONS_MSG_SIMPLE
Logout($GlobalUser['session']);
}
} else {
if ($_POST['db_email'] !== $GlobalUser['pemail'] && $_POST['db_email'] !== "") {
// Сменить адрес
$email = $_POST['db_email'];
if ($GlobalUser['password'] !== md5($_POST['db_password'] . $db_secret)) {
$OptionsError = loca("OPTIONS_ERR_NEEDPASS");
} else {
if (!isValidEmail($email)) {
$OptionsError = loca("OPTIONS_ERR_EMAIL");
} else {
if (IsEmailExist($email)) {
$OptionsError = loca("OPTIONS_ERR_EMAILUSED");
}
}
示例9: Logout
} else {
return "";
}
}
function Logout()
{
// destroy the session
session_destroy();
return "Cierre De Sesion Existoso";
}
$possible_url = array("session", "login", "logout");
$value = "An error has occurred";
if (isset($_GET["action"]) && in_array($_GET["action"], $possible_url)) {
switch ($_GET["action"]) {
case "session":
$value = session();
break;
case "logout":
$value = Logout();
break;
case "login":
if (isset($_GET["id"])) {
$value = DoLogin($_GET["id"]);
} else {
$value = "Missing argument";
}
break;
}
}
//return JSON array
exit(json_encode($value));
示例10: Change_PWUN_response
function Change_PWUN_response($PWUN, $msg)
{
//**********************************
//Update $USERNAME or $HASHWORD. Default $page = changepw or changeun
global $_, $ONESCRIPT, $USERNAME, $HASHWORD, $EX, $message, $page, $ONESCRIPT_file, $ONESCRIPT_file_backup, $CONFIG_FILE, $CONFIG_FILE_backup, $VALID_CONFIG_FILE;
// trim white-space from input values
$current_pass = trim($_POST['password']);
$new_pwun = trim($_POST['new1']);
$confirm_pwun = trim($_POST['new2']);
$error_msg = $EX . '<b>' . hsc($msg) . '</b> ';
//If all fields are blank, do nothing.
if ($current_pass == "" && $new_pwun == "" && $confirm_pwun == "") {
return;
} elseif ($current_pass == "" || $new_pwun == "" || $confirm_pwun == "") {
$message .= $error_msg . hsc($_['change_pw_07']) . '<br>';
} elseif ($new_pwun != $confirm_pwun) {
$message .= $error_msg . hsc($_['change_pw_04']) . '<br>';
} elseif (hashit($current_pass) != $HASHWORD) {
$message .= $error_msg . '<br>' . hsc($_['change_pw_03']) . '<br>';
Logout();
} else {
if ($PWUN == "pw") {
$search_for = '$HASHWORD ';
//include space after $HASHWORD
$replace_with = '$HASHWORD = "' . hashit($new_pwun) . '";';
$success_msg = '<b>' . hsc($_['change_pw_01']) . '</b>';
} else {
//$PWUN = "un"
$search_for = '$USERNAME ';
//include space after $USERNAME
$replace_with = '$USERNAME = "' . $new_pwun . '";';
$success_msg = '<b>' . hsc($_['change_un_01']) . '</b>';
}
//If specified & it exists, update external config file.
if ($VALID_CONFIG_FILE) {
$message .= $_['change_pw_05'] . ' ' . $_['change_pw_06'] . '. . . ';
$updated = Update_config($search_for, $replace_with, $CONFIG_FILE, $CONFIG_FILE_backup);
} else {
//Update OneFileCMS
$message .= $_['change_pw_05'] . ' OneFileCMS . . . ';
$updated = Update_config($search_for, $replace_with, $ONESCRIPT_file, $ONESCRIPT_file_backup);
}
if ($updated === false) {
$message .= $error_msg . '<br>';
} else {
$message .= $success_msg . '<br>';
}
$page = "admin";
//Return to Admin page.
}
}
示例11: TestIfIsToReject
private function TestIfIsToReject($Status)
{
if ($Status == 'Rejected ' or $Status == 'Banned') {
//LogStr("Force Logout GAMEOVER", "Login");
Logout();
die(" You can't use this site anymore");
}
}
示例12: is_not_banned
//.........这里部分代码省略.........
$ban_query[] = "('" . addslashes($user_info['email']) . "' LIKE bi.email_address)";
}
// How about this user?
if (!$user_info['is_guest'] && !empty($ID_MEMBER)) {
$ban_query[] = "bi.ID_MEMBER = {$ID_MEMBER}";
}
// Check the ban, if there's information.
if (!empty($ban_query)) {
$restrictions = array('cannot_access', 'cannot_login', 'cannot_post', 'cannot_register');
$request = db_query("\n\t\t\t\tSELECT bi.ID_BAN, bi.email_address, bi.ID_MEMBER, bg.cannot_access, bg.cannot_register,\n\t\t\t\t\tbg.cannot_post, bg.cannot_login, bg.reason\n\t\t\t\tFROM ({$db_prefix}ban_groups AS bg, {$db_prefix}ban_items AS bi)\n\t\t\t\tWHERE bg.ID_BAN_GROUP = bi.ID_BAN_GROUP\n\t\t\t\t\tAND (bg.expire_time IS NULL OR bg.expire_time > " . time() . ")\n\t\t\t\t\tAND (" . implode(' OR ', $ban_query) . ')', __FILE__, __LINE__);
// Store every type of ban that applies to you in your session.
while ($row = mysql_fetch_assoc($request)) {
foreach ($restrictions as $restriction) {
if (!empty($row[$restriction])) {
$_SESSION['ban'][$restriction]['reason'] = $row['reason'];
$_SESSION['ban'][$restriction]['ids'][] = $row['ID_BAN'];
if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['ID_MEMBER'] == $ID_MEMBER || $row['email_address'] == $user_info['email'])) {
$flag_is_activated = true;
}
}
}
}
mysql_free_result($request);
}
// Mark the cannot_access and cannot_post bans as being 'hit'.
if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post'])) {
log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array()));
}
// If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
if ($ID_MEMBER && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
require_once $sourcedir . '/ManageBans.php';
updateBanMembers();
}
}
// Hey, I know you! You're ehm...
if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
$bans = explode(',', $_COOKIE[$cookiename . '_']);
foreach ($bans as $key => $value) {
$bans[$key] = (int) $value;
}
$request = db_query("\n\t\t\tSELECT bi.ID_BAN, bg.reason\n\t\t\tFROM ({$db_prefix}ban_items AS bi, {$db_prefix}ban_groups AS bg)\n\t\t\tWHERE bg.ID_BAN_GROUP = bi.ID_BAN_GROUP\n\t\t\t\tAND (bg.expire_time IS NULL OR bg.expire_time > " . time() . ")\n\t\t\t\tAND bg.cannot_access = 1\n\t\t\t\tAND bi.ID_BAN IN (" . implode(', ', $bans) . ")\n\t\t\tLIMIT " . count($bans), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
$_SESSION['ban']['cannot_access']['ids'][] = $row['ID_BAN'];
$_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
}
mysql_free_result($request);
// My mistake. Next time better.
if (!isset($_SESSION['ban']['cannot_access'])) {
require_once $sourcedir . '/Subs-Auth.php';
$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], 0);
}
}
// If you're fully banned, it's end of the story for you.
if (isset($_SESSION['ban']['cannot_access'])) {
// We don't wanna see you!
if (!$user_info['is_guest']) {
db_query("\n\t\t\t\tDELETE FROM {$db_prefix}log_online\n\t\t\t\tWHERE ID_MEMBER = {$ID_MEMBER}\n\t\t\t\tLIMIT 1", __FILE__, __LINE__);
}
// 'Log' the user out. Can't have any funny business... (save the name!)
$old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt[28];
$user_info['name'] = '';
$user_info['username'] = '';
$user_info['is_guest'] = true;
$user_info['is_admin'] = false;
$user_info['permissions'] = array();
$ID_MEMBER = 0;
$context['user'] = array('id' => 0, 'username' => '', 'name' => $txt[28], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'language' => $user_info['language']);
// A goodbye present.
require_once $sourcedir . '/Subs-Auth.php';
$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], 0);
// Don't scare anyone, now.
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// You banned, sucka!
fatal_error(sprintf($txt[430], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']));
// If we get here, something's gone wrong.... but let's try anyway.
trigger_error('Hacking attempt...', E_USER_ERROR);
} elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
// !!! Why doesn't this use the function made for logging bans?
db_query("\n\t\t\tUPDATE {$db_prefix}ban_items\n\t\t\tSET hits = hits + 1\n\t\t\tWHERE ID_BAN IN (" . implode(', ', $_SESSION['ban']['cannot_login']['ids']) . ')', __FILE__, __LINE__);
// Log this ban.
db_query("\n\t\t\tINSERT INTO {$db_prefix}log_banned\n\t\t\t\t(ID_MEMBER, ip, email, logTime)\n\t\t\tVALUES ({$ID_MEMBER}, SUBSTRING('{$user_info['ip']}', 1, 16), SUBSTRING('{$user_info['email']}', 1, 255), " . time() . ')', __FILE__, __LINE__);
// SMF's Wipe 'n Clean(r) erases all traces.
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// Logged in, but not for long...
require_once $sourcedir . '/LogInOut.php';
Logout(true);
}
// Fix up the banning permissions.
if (isset($user_info['permissions'])) {
banPermissions();
}
}
示例13: Logout
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => Yii::t('app', 'Home'), 'url' => ['/site/index']], ['label' => Yii::t('app', 'About'), 'url' => ['/site/about']], ['label' => Yii::t('app', 'Contact'), 'url' => ['/site/contact']]];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => Yii::t('app', 'Signup'), 'url' => ['/site/signup']];
$menuItems[] = ['label' => Yii::t('app', 'Login'), 'url' => ['/site/login']];
} else {
$menuItems[] = ['label' => Yii::t('app', Logout(' . Yii::$app->user->identity->username . ')), 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
echo Alert::widget();
?>
<?php
echo $content;
?>