本文整理汇总了PHP中Zend_Session::regenerateId方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::regenerateId方法的具体用法?PHP Zend_Session::regenerateId怎么用?PHP Zend_Session::regenerateId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::regenerateId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
// shares/avatar files are deleted by an off-line routine in crontab
$request = $this->getRequest();
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
$credential = Ml_Model_Credential::getInstance();
$peopleDelete = Ml_Model_PeopleDelete::getInstance();
$signedUserInfo = $registry->get("signedUserInfo");
$form = $peopleDelete->deleteAccountForm();
if ($request->isPost()) {
$credentialInfo = $credential->getByUid($auth->getIdentity());
if (!$credentialInfo) {
throw new Exception("Fatal error on checking credential in account delete controller.");
}
$registry->set('credentialInfoDataForPasswordChange', $credentialInfo);
if ($form->isValid($request->getPost())) {
$registry->set("canDeleteAccount", true);
$peopleDelete->deleteAccount($signedUserInfo, sha1(serialize($signedUserInfo)));
$auth->clearIdentity();
Zend_Session::namespaceUnset('Zend_Auth');
Zend_Session::regenerateId();
Zend_Session::destroy(true);
$this->_redirect("/account/terminated", array("exit"));
}
}
$this->view->deleteAccountForm = $form;
}
示例2: init
public function init()
{
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
$config = $registry->get("config");
$sessionConfig = $config['resources']['session'];
$cookieLifetime = $sessionConfig['cookie_lifetime'];
/* @todo fix issue of system with incoherent behavior when the session
system has a issue, such as when the savehandler doesn't work as
expected when it's off-line which results in differents
catched / uncatched exception when the resource (page) loads
*/
$saveHandler = new Ml_Session_SaveHandler_PlusCache($registry->get("memCache"), $config['session']['prefix'], $config['lastActivity']['prefix']);
Zend_Session::setSaveHandler($saveHandler);
Zend_Session::getSaveHandler()->setLifetime($cookieLifetime, true);
Zend_Session::start();
$defaultNamespace = new Zend_Session_Namespace();
if (!isset($defaultNamespace->initialized)) {
Zend_Session::regenerateId();
$defaultNamespace->initialized = true;
}
if ($auth->hasIdentity()) {
$people = Ml_Model_People::getInstance();
$signedUserInfo = $people->getById($auth->getIdentity());
$registry->set('signedUserInfo', $signedUserInfo);
}
$globalHash = Ml_Model_MagicCookies::getInstance()->getLast(true);
$registry->set("globalHash", $globalHash);
}
示例3: indexAction
public function indexAction()
{
if ($this->getRequest()->getParam('garbage')) {
$this->redirect('');
}
$translator = Zend_Registry::get('Zend_Translate');
if (!$this->getRequest()->isPost()) {
if (Zend_Session::sessionExists()) {
$namespace = $this->_session->getNamespace();
if (isset($_SESSION[$namespace])) {
unset($_SESSION[$namespace]);
}
$translator->setLocale('en');
Zend_Registry::set('Zend_Translate', $translator);
Zend_Session::regenerateId();
}
} else {
$lang = $this->getRequest()->getParam('lang');
if ($lang && Zend_Locale::isLocale($lang)) {
$this->_session->locale->setLocale($lang);
if ($translator->getLocale() !== $lang) {
$translator->setLocale($lang);
Zend_Registry::set('Zend_Translate', $translator);
}
$this->_session->nextStep = 1;
}
if ($this->_session->nextStep !== null) {
return $this->forward('step' . $this->_session->nextStep);
}
}
$this->forward('step1');
}
示例4: logoutAction
public function logoutAction()
{
$this->_helper->layout()->disableLayout();
$serverUrl = 'http://' . AUTH_SERVER . self::AUTH_PATH . '/logout';
$client = new Zend_Http_Client($serverUrl, array('timeout' => 30));
try {
if (isset($_COOKIE[self::AUTH_SID])) {
$moduleName = $this->getRequest()->getModuleName();
$client->setCookie('PHPSESSID', $_COOKIE[self::AUTH_SID]);
$client->setCookie('moduleName', $moduleName);
$response = $client->request();
if ($response->isError()) {
$remoteErr = $remoteErr = 'REMOTE ERROR: (' . $response->getStatus() . ') ' . $response->getMessage() . ', i.e. ' . $response->getHeader('Message');
throw new Zend_Exception($remoteErr, Zend_Log::ERR);
}
} else {
$this->_helper->logger('No remote cookie found. So, not requesting AUTH_SERVER to logout.');
}
} catch (Zend_Exception $e) {
echo $e->getMessage();
}
preg_match('/[^.]+\\.[^.]+$/', $_SERVER['SERVER_NAME'], $domain);
if (isset($_COOKIE[self::AUTH_SID])) {
setcookie(self::AUTH_SID, '', time() - 360000, self::AUTH_PATH, ".{$domain['0']}");
}
if (isset($_COOKIE['last'])) {
setcookie('last', '', time() - 36000, '/', ".{$domain['0']}");
}
if (isset($_COOKIE['identity'])) {
setcookie('identity', '', time() - 36000, '/', ".{$domain['0']}");
}
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::destroy();
Zend_Session::regenerateId();
}
示例5: Login
/**
* Login function authentication system
* @param Zend_Db_Table_Row $account
* @return boolean
*/
function Login(Zend_Db_Table_Row $account)
{
$select = $this->select()->where('email=?', $account->email)->limit(1);
$row = $this->fetchRow($select);
// set up the auth adapter
$db = Acl_Model_Account::getDefaultAdapter();
$authAdapter = new OS_Application_Adapter_Auth($account->email, $account->password);
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
$authAdapter->setTableName($this->_name)->setIdentityColumn('email')->setCredentialColumn('password')->setCredentialTreatment('block = 0');
#->setCredentialTreatment('MD5(?) and block = 0');
$authAdapter->setIdentity($account->email);
$authAdapter->setCredential(crypt($account->password, $row->password));
$result = $authAdapter->authenticate();
Zend_Session::regenerateId();
if ($result->isValid()) {
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$storage->write($authAdapter->getResultRowObject(array('id', 'email', 'registerdate', 'lastvisitdate', 'role_id', 'fullname', 'email_alternative')));
$account = $this->find($authAdapter->getResultRowObject()->id)->current();
#$account = $this->createRow( $account->toArray() );
$account->lastvisitdate = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$account->save();
return true;
}
return false;
}
示例6: loginAction
public function loginAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$formLogin = new Application_Form_Login();
if ($this->getRequest()->isPost()) {
foreach ($this->_request->getPost('dataPost') as $dataArray) {
$name = $dataArray['name'];
$formDataForValidation["{$name}"] = $dataArray['value'];
}
if ($formLogin->isValid($formDataForValidation)) {
$user = $formDataForValidation['email'];
$password = $formDataForValidation['password'];
$adapter = new Zend_Auth_Adapter_DbTable(null, 'users', 'email', 'password');
$adapter->setIdentity($user);
$adapter->setCredential($password);
Zend_Session::regenerateId();
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$user = $adapter->getResultRowObject();
$auth->getStorage()->write($user);
$this->_helper->json(0);
} else {
$this->_helper->json(1);
}
} else {
$this->_helper->json(1);
}
}
}
示例7: loginAction
public function loginAction()
{
//$this->_helper->layout->disableLayout();
$this->_helper->layout()->setLayout('layout-front');
$r = $this->getRequest();
//$returnTo = $r->getParam('returnTo');
//$this->view->returnTo = urlencode($returnTo);
if ($r->isPost()) {
$returnTo = $r->getParam('returnTo');
$this->view->returnTo = $returnTo;
Zend_Session::start();
$username = $r->getParam('username');
$password = $r->getParam('password');
$authAdapterFactory = new Kutu_Auth_Adapter_Factory();
$authAdapter = $authAdapterFactory->getAdapter();
$authAdapter->setIdentity($username)->setCredential($password);
$auth = Zend_Auth::getInstance();
$authResult = $auth->authenticate($authAdapter);
if ($authResult->isValid()) {
Zend_Session::regenerateId();
// success : store database row to auth's storage
$data = $authAdapter->getResultRowObject();
$auth->getStorage()->write($data);
if (strpos($returnTo, '?')) {
$sAddition = '&';
} else {
$sAddition = '?';
}
header("location: " . $returnTo . $sAddition . "PHPSESSID=" . Zend_Session::getId());
} else {
if ($authResult->getCode() != -51) {
// failure : clear database row from session
Zend_Auth::getInstance()->clearIdentity();
}
$this->view->errorMessage = "Login GAGAL";
}
} else {
Zend_Session::start();
$returnTo = $r->getParam('returnTo');
if (!empty($returnTo)) {
$returnTo = urldecode($returnTo);
$this->view->returnTo = $returnTo;
} else {
$returnTo = KUTU_ROOT_URL . '/identity/account';
$this->view->returnTo = $returnTo;
}
//check sudah login belum
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
//echo "punya identitas";
if (strpos($returnTo, '?')) {
$sAddition = '&';
} else {
$sAddition = '?';
}
header("location: " . $returnTo . $sAddition . "PHPSESSID=" . Zend_Session::getId());
}
}
}
示例8: loginAction
/**
* Log in - show the login form or handle a login request
*
* @todo Implement real authentication
*/
public function loginAction()
{
if ($this->getRequest()->getMethod() != 'POST') {
// Not a POST request, show log-in form
$view = $this->initView();
$this->render();
} else {
// Handle log-in form
$username = $this->getRequest()->getParam('user');
if ($username) {
$password = $this->getRequest()->getParam('password');
} else {
$username = $this->getRequest()->getParam('suser');
$password = $this->getRequest()->getParam('spassword');
}
// setup Zend_Auth adapter for a database table
$dbAdapters = Zend_Registry::get('dbAdapters');
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapters['user'], 'nukevo_users', 'username', 'user_password', 'MD5(?)');
// Set the input credential values to authenticate against
$authAdapter->setIdentity($username);
$authAdapter->setCredential($password);
// do the authentication
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
// success: store database row to auth's storage
// system. (Not the password though!)
$data = $authAdapter->getResultRowObject(null, 'password');
$auth->getStorage()->write($data);
Zend_Session::regenerateId();
$this->session->logged_in = true;
$this->session->username = $username;
$player_table = new Player();
$player = $player_table->getPlayerForUsername($username);
if ($player) {
$this->session->steamid = $player->steamid;
} else {
$member_table = new Members();
$member = $member_table->getMember($user);
if ($member) {
$this->session->steamid = 'STEAM_' . $member->steamid;
// Update player record's username
$player = $player_table->getPlayerForSteamid($this->session->steamid);
if ($player) {
$where = $table->getAdapter()->quoteInto('steamid = ?', $this->session->steamid);
$player_table->update(array('username' => $username), $where);
}
}
}
//$this->_forward('profile');
$this->_redirect('/sc/player/show/user/' . $username);
} else {
$view = $this->initView();
$view->user = $username;
$view->error = 'Wrong user name or password, please try again';
$this->render();
}
}
}
示例9: clearSession
/**
* Clear the session information
*/
public static function clearSession()
{
$authCookieName = Zend_Registry::get('config')->General->login_cookie_name;
$cookie = new Core_Cookie($authCookieName);
$cookie->delete();
Zend_Session::expireSessionCookie();
Zend_Session::regenerateId();
}
示例10: _initSession
protected function _initSession()
{
$session = new Zend_Session_Namespace('ipmcore');
Zend_Registry::set('session', $session);
if (!isset($session->initialized)) {
Zend_Session::regenerateId();
$session->initialized = true;
}
}
示例11: __construct
private function __construct()
{
Zend_Session::start();
$this->namespace = new Zend_Session_Namespace('sessaoproponente');
if (!isset($this->namespace->initialized)) {
Zend_Session::regenerateId();
$this->namespace->initialized = true;
}
}
示例12: login
/**
* @param string $username
* @param string $password
* @return boolean
*/
public function login($username, $password)
{
$adapter = $this->getAuthAdapter();
$adapter->setIdentity($username);
$adapter->setCredential($password);
$result = $this->getAuth()->authenticate($adapter);
\Zend_Session::regenerateId();
return $result->isValid();
}
示例13: init
/**
* Initialize session namespace
*
* @return Zend_Session_Namespace
*/
public function init()
{
Zend_Session::start();
$defaultNamespace = new Zend_Session_Namespace('Default');
if (!isset($defaultNamespace->initialized)) {
Zend_Session::regenerateId();
$defaultNamespace->initialized = true;
}
return $defaultNamespace;
}
示例14: setProperty
/**
* Push value to session with key.
*
* @param $key
* @param $value
*/
public static function setProperty($key, $value)
{
$myNamespace = new Zend_Session_Namespace(self::NAME);
if (!isset($myNamespace->initialized)) {
Zend_Session::regenerateId();
$myNamespace->initialized = true;
}
$myNamespace->setExpirationSeconds(self::EXPIRE_IN_SEC, $key);
$myNamespace->{$key} = $value;
}
示例15: _processValidators
private static function _processValidators()
{
foreach ($_SESSION['__KWF']['VALID'] as $validator_name => $valid_data) {
$validator = new $validator_name();
if ($validator->validate() === false) {
$_SESSION = array();
Zend_Session::regenerateId();
break;
}
}
}