本文整理汇总了PHP中Horde::setupSessionHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::setupSessionHandler方法的具体用法?PHP Horde::setupSessionHandler怎么用?PHP Horde::setupSessionHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::setupSessionHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
}
header('Location: ' . $url);
exit;
}
$language = isset($prefs) ? $prefs->getValue('language') : NLS::select();
$entry = sprintf('User %s [%s] logged out of Horde', Auth::getAuth(), $_SERVER['REMOTE_ADDR']);
Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
Auth::clearAuth();
session_destroy();
/* If logout has a set initial page, redirect to that. Check that
* it is not a looping redirect. */
if (isset($registry->applications['logout']['initial_page']) && $registry->applications['logout']['initial_page'] != 'login.php?' . AUTH_REASON_PARAM . '=' . AUTH_REASON_LOGOUT) {
header('Location: ' . Horde::applicationUrl($registry->applications['logout']['initial_page']));
exit;
}
Horde::setupSessionHandler();
@session_start();
NLS::setLang($language);
/* Hook to preselect the correct language in the widget. */
$_GET['new_lang'] = $language;
}
if (isset($_POST['horde_user']) && isset($_POST['horde_pass'])) {
/* Destroy any existing session on login and make sure to use a
* new session ID, to avoid session fixation issues. */
Horde::getCleanSession();
if ($auth->authenticate(Util::getPost('horde_user'), array('password' => Util::getPost('horde_pass')))) {
$entry = sprintf('Login success for %s [%s] to Horde', Auth::getAuth(), $_SERVER['REMOTE_ADDR']);
Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
if ($url_param) {
$url = Horde::url(Util::removeParameter($url_param, session_name()), true);
$horde_url = Horde::applicationUrl($registry->getParam('webroot', 'horde') . '/index.php', true);
示例2: getCleanSession
/**
* Destroys any existing session on login and make sure to use a new
* session ID, to avoid session fixation issues. Should be called before
* checking a login.
*/
function getCleanSession()
{
// Make sure to force a completely new session ID and clear all
// session data.
if (version_compare(PHP_VERSION, '4.3.3') !== -1) {
session_regenerate_id(true);
session_unset();
} else {
$old_error = error_reporting(0);
session_destroy();
error_reporting($old_error);
if (Util::extensionExists('posix')) {
$new_session_id = md5(microtime() . posix_getpid());
} else {
$new_session_id = md5(uniqid(mt_rand(), true));
}
session_id($new_session_id);
// Restart the session, including setting up the session handler.
Horde::setupSessionHandler();
error_reporting(0);
session_start();
error_reporting($old_error);
}
/* Reset cookie timeouts, if necessary. */
if (!empty($GLOBALS['conf']['session']['timeout'])) {
$app = $GLOBALS['registry']->getApp();
if (Secret::clearKey($app)) {
Secret::setKey($app);
}
Secret::setKey('auth');
}
}