當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Session::regenerateId方法代碼示例

本文整理匯總了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;
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:28,代碼來源:AccountdeleteController.php

示例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);
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:29,代碼來源:Mysession.php

示例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');
 }
開發者ID:PavloKovalov,項目名稱:seotoaster,代碼行數:32,代碼來源:IndexController.php

示例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();
 }
開發者ID:sivarajankumar,項目名稱:eduis,代碼行數:35,代碼來源:AuthenticateController.php

示例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;
 }
開發者ID:rogercastaneda,項目名稱:owlsys,代碼行數:31,代碼來源:Account.php

示例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);
         }
     }
 }
開發者ID:bogdanmatra,項目名稱:ibm-hackathon,代碼行數:31,代碼來源:IndexController.php

示例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());
         }
     }
 }
開發者ID:psykomo,項目名稱:kutump-enhanced,代碼行數:59,代碼來源:IdentityController.php

示例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();
         }
     }
 }
開發者ID:neffers,項目名稱:Nefcraft,代碼行數:64,代碼來源:UserController.php

示例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();
 }
開發者ID:ptarcher,項目名稱:exercise_mvc,代碼行數:11,代碼來源:Controller.php

示例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;
     }
 }
開發者ID:Tony133,項目名稱:zf-web,代碼行數:9,代碼來源:Bootstrap.php

示例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;
     }
 }
開發者ID:hackultura,項目名稱:novosalic,代碼行數:9,代碼來源:SessaoProponente.php

示例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();
 }
開發者ID:lukaszjankowski,項目名稱:alchemy,代碼行數:14,代碼來源:User.php

示例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;
 }
開發者ID:rockett,項目名稱:parables,代碼行數:15,代碼來源:Defaultnamespace.php

示例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;
 }
開發者ID:BGCX262,項目名稱:zufangzi-svn-to-git,代碼行數:16,代碼來源:SessionUtil.php

示例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;
         }
     }
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:11,代碼來源:Session.php


注:本文中的Zend_Session::regenerateId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。