本文整理汇总了PHP中auth_logout函数的典型用法代码示例。如果您正苦于以下问题:PHP auth_logout函数的具体用法?PHP auth_logout怎么用?PHP auth_logout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth_logout函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auth_is_member_of
function auth_is_member_of($groupname)
{
try {
foreach (backend_hent_brugers_medlemskaber($_SESSION['brugernavn']) as $group) {
if ($group['gruppenavn'] == $groupname) {
return true;
}
}
} catch (DatabaseException $e) {
} catch (UkendtBrugerException $e) {
auth_logout();
header('location: login.php');
die('User not found.');
}
return false;
}
示例2: form_security_validate
* MantisBT Core API's
*/
require_once 'core.php';
require_once 'email_api.php';
form_security_validate('signup');
$f_username = strip_tags(gpc_get_string('username'));
$f_email = strip_tags(gpc_get_string('email'));
$f_captcha = gpc_get_string('captcha', '');
$f_username = trim($f_username);
$f_email = email_append_domain(trim($f_email));
$f_captcha = utf8_strtolower(trim($f_captcha));
# Retrieve captcha key now, as session might get cleared by logout
$t_form_key = session_get_int(CAPTCHA_KEY, null);
# force logout on the current user if already authenticated
if (auth_is_user_authenticated()) {
auth_logout();
}
# Check to see if signup is allowed
if (OFF == config_get_global('allow_signup')) {
print_header_redirect('login_page.php');
exit;
}
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && helper_call_custom_function('auth_can_change_password', array())) {
# captcha image requires GD library and related option to ON
$t_key = utf8_strtolower(utf8_substr(md5(config_get('password_confirm_hash_magic_string') . $t_form_key), 1, 5));
if ($t_key != $f_captcha) {
trigger_error(ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR);
}
# Clear captcha cache
session_delete(CAPTCHA_IMG);
}
示例3: array
<?php
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
if (isset($_GET['token']) && isset($_SESSION['logout_cookie']) && $_GET['token'] == $_SESSION['logout_cookie']) {
//load language specific variables
require_once $stylepath . '/login.inc.php';
if (auth_logout() == true) {
$_SESSION = array();
session_destroy();
}
}
}
$target = isset($_GET['target']) ? $target : "index.php";
header('Location: ' . urlencode($target));
die;
示例4: login_display
//.........这里部分代码省略.........
Try <a href="index.php?view=login&task=login">logging in</a> if that is the case.</p>
<?php
} else {
// Format the birth date correctly
$data['birth_date'] = form2sql_date($data['birth_date']);
$user = auth_register($data);
if ($user == null) {
$show_form = false;
?>
<p><strong>Thanks for registering!</strong><br /> Please proceed to <a href="index.php?view=login&task=login">login</a> into your new account.</p>
<?php
} else {
?>
<p><b>That user-handle has already been taken!</b><br/> It belongs to an user registered with the name <?php
echo $user['first_name'] . ' ' . $user['last_name'];
?>
. Please try again with another handle.</p>
<?php
}
}
}
if ($show_form) {
?>
<p><strong>Please fill in your details below.</strong><br />
Please choose your <strong>handle</strong> and <strong>division</strong> carefully. Once chosen, they cannot be changed. Moreover, choosing an inappropriate division will lead to disqualification.
<br>
<br>Any doubts and problems should find their way to the <? echo '<a href="mailto:'.$cfg["site"]["email"].'">admins</a>'; ?>.
</p>
<?php
$form->display();
}
break;
case 'logout':
auth_logout();
redirect('index.php');
break;
case 'login':
$form = new HTML_QuickForm('loginForm', 'post', 'index.php?view=login&task=login');
$form->addElement('header', null, 'Login');
$form->addElement('text', 'handle', 'Handle:');
$form->addElement('password', 'password', 'Password:');
$form->addElement('submit', null, 'Submit');
$form->applyFilter('handle', 'trim');
$form->applyFilter('handle', 'strtolower');
if ($form->validate()) {
if (auth_login($form->getSubmitValue('handle'), $form->getSubmitValue('password'))) {
redirect('index.php');
} else {
echo "<p>Invalid handle or password! Please try again.</p>\n";
}
} else {
$signature = '<i>' . $_SERVER['SERVER_SOFTWARE'] . ' Server at ' . $_SERVER['SERVER_NAME'] . ', port ' . $_SERVER['SERVER_PORT'] . '</i>';
?>
<p><strong>Welcome!</strong><br />
Please login to proceed, or <a href="index.php?view=login&task=register">register</a>
with us if you're new here.</p>
<?php
}
$form->display();
?>
<p class="system_info">This is <b>OGS 2</b> running on <? echo $signature ?>.<br />
<b>Server System:</b> <?php
system("uname -srmp");
?>
</p>
<hr />
示例5: var_dump
echo var_dump($arr);
//$contents = fread($handle, filesize($filename));
fclose($handle);
// parse dic file
// ...
}
echo "error - {$error} id is {$id} " . var_dump($_FILES);
if (!$error) {
echo var_dump($files);
}
}
//
// New case block
//
if ($cmd == "logout") {
$return = auth_logout();
}
if ($cmd == "auth") {
$return = auth_login();
}
//
if ($auth) {
$subcmd = substr($cmd, strlen($cmd) - 4);
if ($subcmd == "_lst" || $subcmd == "_str" || $subcmd == "_upd" || $subcmd == "_del" || $subcmd == "_new") {
$return = process_table();
} else {
if ($cmd == "text_anl") {
$return = text_analyser();
}
if ($cmd == "dic_upl") {
$return = dic_upload();
示例6: router
/**
* @description router app
* @param $uri
*/
function router($uri)
{
$uri = explode('?', $uri);
$uri = ltrim($uri[0], '/');
$page = !empty($_GET['page']) ? $_GET['page'] : null;
$id = !empty($_GET['id']) ? $_GET['id'] : null;
$method = strtolower($_SERVER["REQUEST_METHOD"]);
/**
* @method POST
*/
if ($method == 'post') {
switch ($uri) {
case 'login':
post_login_controller();
break;
case 'post/store':
store_post_controller();
break;
case "post/{$id}" && isset($_POST['_method']) && $_POST['_method'] == 'PUT':
update_post_controller($id);
break;
case "post/{$id}" && isset($_POST['_method']) && $_POST['_method'] == 'DELETE':
destroy_post_controller($id);
break;
default:
throw new RuntimeException('routing error');
}
}
/**
* @method GET
*/
if ($method == 'get') {
switch ($uri) {
case '':
home_controller();
break;
case "single/{$id}":
show_controller($id);
break;
case "category/{$id}":
show_post_by_category_controller($id);
break;
case 'login':
login_controller();
break;
case "post/{$id}/edit":
edit_post_controller($id);
break;
case preg_match('/dashboard/', $uri) ? true : false:
index_post_controller($page);
break;
case 'post/create':
create_post_controller();
break;
case 'logout':
auth_logout();
redirect('/');
break;
default:
throw new RuntimeException('routing error');
}
}
}