本文整理汇总了PHP中logout_user函数的典型用法代码示例。如果您正苦于以下问题:PHP logout_user函数的具体用法?PHP logout_user怎么用?PHP logout_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logout_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PP_Init
/**
* Triggered on loc_begin_index
*
* Perform user logout after registration if account locked and redirection to profile page is password renewal is set
*/
function PP_Init()
{
global $conf, $user;
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
$conf_PP = unserialize($conf['PasswordPolicy']);
// Perfoming redirection for locked accounts
// -----------------------------------------
if (!is_a_guest() and $user['username'] != "16" and $user['username'] != "18") {
// Perform user logout if user account is locked
if (isset($conf_PP['LOGFAILBLOCK']) and $conf_PP['LOGFAILBLOCK'] == 'true' and PP_UsrBlock_Verif($user['username']) and !is_admin() and !is_webmaster()) {
invalidate_user_cache();
logout_user();
if ($conf['guest_access']) {
redirect(make_index_url() . '?PP_msg=locked', 0);
} else {
redirect(get_root_url() . 'identification.php?PP_msg=locked', 0);
}
}
}
// Performing redirection to profile page for password reset
// ---------------------------------------------------------
if (isset($conf_PP['PWDRESET']) and $conf_PP['PWDRESET'] == 'true') {
$query = '
SELECT user_id, status
FROM ' . USER_INFOS_TABLE . '
WHERE user_id = ' . $user['id'] . '
;';
$data = pwg_db_fetch_assoc(pwg_query($query));
if ($data['status'] != "webmaster" and $data['status'] != "generic") {
if (PP_check_pwdreset($user['id'])) {
redirect(PHPWG_ROOT_PATH . 'profile.php');
}
}
}
}
示例2: requestLogin
/**
* Try to perform a login, perform_login_if_requested will redirect as necessary
*/
public function requestLogin()
{
$logged_out = in('logged_out');
// Logout page redirected to this one, so display the message.
$login_error_message = in('error');
// Error to display after unsuccessful login and redirection.
$is_logged_in = is_logged_in();
$pass = post('pass');
$username_requested = post('user');
if ($logged_out) {
logout_user();
// Perform logout if requested!
} else {
if ($username_requested === null || $pass === null) {
$login_error_message = 'No username or no password specified';
}
}
if (!$login_error_message && !$is_logged_in) {
$login_error_message = self::perform_login_if_requested($username_requested, $pass);
}
if ($login_error_message) {
return new RedirectResponse('/login.php?error=' . url($login_error_message));
} else {
// Successful login, go to the main page
return new RedirectResponse('/');
}
}
示例3: main
function main()
{
// создаем сессию
session_start();
// выполняем выход из системы и перенаправляем пользователя на главную страницу
logout_user();
redirect('./');
}
示例4: logout
function logout($echo = false, $redirect = 'index.php')
{
return logout_user($echo, $redirect);
}
示例5: logout
public function logout()
{
logout_user();
set_alert('success', 'Successfully logout.');
redirect('account/login');
exit;
}
示例6: logout
/**
* Logout user
*/
public function logout()
{
logout_user();
redirect('login');
}
示例7: logout
function logout()
{
logout_user();
header("Location: index.php");
}
示例8: logout
function logout()
{
logout_user();
$this->wrap(self::STATUS_OK, array("status" => "OK"));
}
示例9: index
public function index()
{
logout_user();
return new RedirectResponse('/logout/loggedout');
}
示例10: signOutAction
public function signOutAction()
{
logout_user();
$this->redirect_to(home_root_path_path());
}
示例11: deleteAccount
/**
* Make account non-operational
*/
public function deleteAccount()
{
$session = SessionFactory::getSession();
$player = new Player(self_char_id());
$self_info = $player->dataWithClan();
$passW = in('passw', null);
$username = $self_info['uname'];
$error = '';
$command = in('command');
$delete_attempts = $session->get('delete_attempts', 0);
$verify = self::is_authentic($username, $passW);
if ($verify && empty($delete_attempts)) {
// only allow account deletion on first attempt
$this->pauseAccount($player->id());
logout_user();
// This may redirect and stuff?
} else {
$session->set('delete_attempts', $delete_attempts + 1);
$error = 'Deleting of account failed, please email ' . SUPPORT_EMAIL;
}
$parts = ['command' => $command, 'error' => $error, 'delete_attempts' => $delete_attempts];
return $this->render($parts);
}
示例12: UAM_USR_ScheduledTasks
/**
* Triggered on UAM_LoginTasks()
*
* Executes optional post-login tasks for unvalidated users
*
*/
function UAM_USR_ScheduledTasks()
{
global $conf, $user, $page;
if (!defined('PHPWG_ROOT_PATH')) {
die('Hacking attempt!');
}
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
$conf_UAM = unserialize($conf['UserAdvManager']);
$collection = array();
$reminder = false;
$page['filtered_users'] = get_unvalid_user_autotasks();
foreach ($page['filtered_users'] as $listed_user) {
array_push($collection, $listed_user['id']);
}
// Unvalidated accounts auto email sending and autodeletion if user already reminded
// ---------------------------------------------------------------------------------
if (isset($conf_UAM['USRAUTO']) and $conf_UAM['USRAUTO'] == 'true') {
if (count($collection) > 0) {
// Process if a non-admin nor webmaster user is logged
// ---------------------------------------------------
if (in_array($user['id'], $collection)) {
// Check ConfirmMail reminder state
// --------------------------------
$query = '
SELECT reminder
FROM ' . USER_CONFIRM_MAIL_TABLE . '
WHERE user_id = ' . $user['id'] . ';';
$result = pwg_db_fetch_assoc(pwg_query($query));
if (isset($result['reminder']) and $result['reminder'] == 'true') {
$reminder = true;
} else {
$reminder = false;
}
// If never reminded before, send reminder and set reminder True
// -------------------------------------------------------------
if (!$reminder and isset($conf_UAM['USRAUTOMAIL']) and $conf_UAM['USRAUTOMAIL'] == 'true') {
$typemail = 1;
// Get current user information
// ----------------------------
$query = '
SELECT id, username, mail_address
FROM ' . USERS_TABLE . '
WHERE id = ' . $user['id'] . '
;';
$data = pwg_db_fetch_assoc(pwg_query($query));
ResendMail2User($typemail, $user['id'], stripslashes($data['username']), $data['mail_address'], true);
}
// If already reminded before, delete user
// ---------------------------------------
if ($reminder) {
// delete account
delete_user($user['id']);
// Logged-in user cleanup, session destruction and redirected to custom page
// -------------------------------------------------------------------------
invalidate_user_cache();
logout_user();
redirect(make_index_url() . '?UAM_msg=deleted', 0);
}
} else {
foreach ($collection as $user_id) {
// Check reminder state
// --------------------
$query = '
SELECT reminder
FROM ' . USER_CONFIRM_MAIL_TABLE . '
WHERE user_id = ' . $user_id . ';';
$result = pwg_db_fetch_assoc(pwg_query($query));
if (isset($result['reminder']) and $result['reminder'] == 'true') {
$reminder = true;
} else {
$reminder = false;
}
// If never reminded before, send reminder and set reminder True
// -------------------------------------------------------------
if (!$reminder and isset($conf_UAM['USRAUTOMAIL']) and $conf_UAM['USRAUTOMAIL'] == 'true') {
$typemail = 1;
// Get current user information
// ----------------------------
$query = '
SELECT id, username, mail_address
FROM ' . USERS_TABLE . '
WHERE id = ' . $user_id . '
;';
$data = pwg_db_fetch_assoc(pwg_query($query));
ResendMail2User($typemail, $user_id, stripslashes($data['username']), $data['mail_address'], true);
} elseif ($reminder) {
// Delete account
// --------------
delete_user($user_id);
}
}
}
}
}
//.........这里部分代码省略.........
示例13: validate_csrf_get_token
/**
* Validate CSRF token, GET only.
* User will get logged out in case $logout=true and error reporting does not stop script.
*
* @access public
* @param string $token_name (default: 'csrftoken')
* @param bool $logout (default: true)
* @return bool
*/
function validate_csrf_get_token($token_name = 'csrftoken', $logout = true)
{
if ($_SERVER['REQUEST_METHOD'] === 'GET' && count($_GET)) {
if (empty($_GET[$token_name])) {
if ($logout) {
trigger_error('No CSRF GET token found, probable invalid request.', E_USER_ERROR);
logout_user('csrf-get-invalid', 'danger');
}
return false;
}
if ($_GET[$token_name] !== get_token_get_value($token_name)) {
if ($logout) {
trigger_error('Validating the CSRF GET token failed, probable an outdated request.', E_USER_ERROR);
logout_user('csrf-get-failed', 'danger');
}
return false;
}
}
return true;
}
示例14: logout_user
<?php
$alive = false;
$private = false;
$quickstat = false;
$page_title = "Log out";
include SERVER_ROOT . "interface/header.php";
logout_user($echo = true, $redirect = false);
// From lib_auth (for authenticate)
include SERVER_ROOT . "interface/footer.php";
示例15: perform_login_if_requested
function perform_login_if_requested($is_logged_in, $login_requested, $settings)
{
Request::setTrustedProxies(Constants::$trusted_proxies);
$request = Request::createFromGlobals();
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
// Extract the settings as sent in below.
list($logged_out, $username_requested, $pass, $referrer, $stored_username) = $settings;
// already logged in/login behaviors
if ($logged_out) {
logout_user();
// Perform logout if requested!
$is_logged_in = false;
} elseif (!$is_logged_in) {
// Perform login if they aren't already logged in.
if ($login_requested) {
// Request to login was made.
$login_attempt_info = array('username' => $username_requested, 'user_agent' => $user_agent, 'ip' => $request->getClientIp(), 'successful' => 0, 'additional_info' => $_SERVER);
$logged_in = login_user($username_requested, $pass);
$is_logged_in = $logged_in['success'];
if (!$is_logged_in) {
// Login was attempted, but failed, so display an error.
store_auth_attempt($login_attempt_info);
$login_error_message = $logged_in['login_error'];
redirect("login.php?error=" . url($login_error_message));
} else {
// log a successful login attempt
$login_attempt_info['successful'] = 1;
store_auth_attempt($login_attempt_info);
redirect("/");
// Successful login, go to the main page...
}
}
}
return array($is_logged_in, $logged_out, $referrer, $stored_username);
}