当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Session_Namespace类代码示例

本文整理汇总了PHP中Zend_Session_Namespace的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session_Namespace类的具体用法?PHP Zend_Session_Namespace怎么用?PHP Zend_Session_Namespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Session_Namespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loginAction

 public function loginAction()
 {
     try {
         $this->_helper->layout->disableLayout();
         $request = $this->getRequest();
         $sessionNamespace = new Zend_Session_Namespace();
         if ($sessionNamespace->loginAuth == true) {
             $this->_helper->redirector('index', 'index', 'gyuser');
         }
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_OperatorDataMapper();
             $Obj = new Gyuser_Model_Operator();
             if ($request->user_name) {
                 $Obj->setEmail($request->user_name);
             }
             if ($request->password) {
                 $Obj->setPassword($request->password);
             }
             $result = $mapper->LoginAuth($Obj);
             if ($result->getId()) {
                 $sessionNamespace = new Zend_Session_Namespace();
                 $sessionNamespace->loginAuth = true;
                 $sessionNamespace->authDetail = $result;
                 $sessionNamespace->setExpirationSeconds(7 * 24 * 60 * 60, 'a');
                 $this->_helper->redirector('dashboard', 'index', 'gyuser');
             } else {
                 $this->view->invalid = true;
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
开发者ID:lschnoller,项目名称:boonding,代码行数:33,代码来源:IndexController.php

示例2: clearSessionBYStep

 function clearSessionBYStep($step)
 {
     $session_step = new Zend_Session_Namespace('bookcitytour');
     if ($step == 1) {
         $session_step->unsetAll();
         // 			$session_step->pickup_date =null;
         // 			$session_step->pickup_time = null;
         // 			$session_step->pickup_mins = null;
         // 			$session_step->step2 =0;
         // 			$session_step->return_date = null;
         // 			$session_step->return_time =null;
         // 			$session_step->return_mins =null;
         // 			$session_step->vehiclevaliable = null;
     } elseif ($step == 2) {
         $session_step->step3 = 0;
         $session_step->vehicle_id = null;
         //$data get parram store value only not array
         $session_step->price = 0;
         $session_step->guideavaliable = null;
         $session_step->vehicle_name = null;
         $session_step->guide_id = null;
         $session_step->step4 = 0;
         $session_step->guidename = null;
         $session_step->guideprice = null;
     } elseif ($step == 3) {
         $session_step->guide_id = null;
         $session_step->step4 = 0;
         $session_step->guidename = null;
         $session_step->guideprice = null;
     }
 }
开发者ID:samlanh,项目名称:lynacr,代码行数:31,代码来源:Dbbookingcitytour.php

示例3: indexAction

 public function indexAction()
 {
     $this->view->headTitle("uiwiki-登陆");
     if ($this->getRequest()->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         //表单的post值
         $name = $filter->filter($this->_request->getPost('name'));
         $password = $filter->filter($this->_request->getPost('password'));
         if (!empty($name)) {
             $authAdapter = new Zend_Auth_Adapter_DbTable();
             $authAdapter->setTableName('ui_project')->setIdentityColumn('name')->setCredentialColumn('password')->setIdentity($name)->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             // 执行认证查询,并保存结果
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(array('name', 'id'));
                 if ($auth->hasIdentity()) {
                     //auth之后写入session
                     $user = new Zend_Session_Namespace('user');
                     $user->name = $data->name;
                     $user->id = $data->id;
                     $user->setExpirationSeconds(6000);
                     //命名空间 "user" 将在第一次访问后 6000 秒过期
                     //echo '<h3><font color=red> 登录成功!</font></h3>';
                     $this->_redirect('/' . $name);
                 }
             } else {
                 echo '<h3><font color=red> 登录失败,请重新登录!</font></h3>';
             }
         }
     }
 }
开发者ID:BGCX262,项目名称:zwh-web-svn-to-git,代码行数:33,代码来源:IndexController.php

示例4: logoutAction

 public function logoutAction()
 {
     Zend_Auth::getInstance()->clearIdentity();
     $session = new Zend_Session_Namespace('userSession');
     $session->unsetAll();
     $this->_redirect("/giris/index");
 }
开发者ID:ugurcanelveren,项目名称:egitim,代码行数:7,代码来源:GirisController.php

示例5: __construct

 /**
  * Constructor
  *
  * @param string $sessionId
  */
 public function __construct($sessionId)
 {
     // session storage
     $this->_session = new \Zend_Session_Namespace(__CLASS__ . $sessionId);
     $this->_session->setExpirationSeconds($this->_expiration);
     // 3 hours
 }
开发者ID:noglance,项目名称:ZF-Vkontakte-SDK,代码行数:12,代码来源:Session.php

示例6: _initSession

 public function _initSession()
 {
     Zend_Session::start();
     $defaultNameSpace = new Zend_Session_Namespace("defaultsession");
     $defaultNameSpace->setExpirationSeconds(7200);
     Zend_Registry::set("defaultsession", $defaultNameSpace);
 }
开发者ID:ocpyosep78,项目名称:Booking,代码行数:7,代码来源:Bootstrap.php

示例7: indexAction

 public function indexAction()
 {
     $this->_helper->layout()->setLayout("blank");
     $auth = new Zend_Session_Namespace('Zend_Auth');
     $auth->unsetAll();
     return $this->_redirect('/index');
 }
开发者ID:bajabob,项目名称:IdleGuard,代码行数:7,代码来源:LogoutController.php

示例8: isAuthorized

 /**
  * Checks whether the user is authorized to use a specific module
  * @param \Zend_Session_Namespace $session The session namespace
  * @param string $url The URL to check against
  * @return boolean
  */
 public static function isAuthorized(\Zend_Session_Namespace $session, $url)
 {
     $authorized = false;
     $module = Functions::getModuleNameFromURL($url);
     switch ($session->getNamespace()) {
         case 'internal':
             $visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?: $_SERVER['REMOTE_ADDR'];
             $authorized = static::cidrCheck($visitor_ip, unserialize(ALLOWED_IPS)) && static::checkUserPrivileges($session->user_name, $module);
             break;
         case 'student':
             $authorized = $module === 'student';
             break;
         case 'faculty':
             $authorized = $module === 'faculty';
             break;
         case 'professor':
             $authorized = $module === 'professor';
             break;
         case 'cron':
             $authorized = true;
             break;
         default:
             throw new \InvalidArgumentException('Invalid user class.');
     }
     // @TODO Move to a callback function
     if (!$authorized) {
         header('Location: https://' . URL_CUSTOM_HANDLERS . '/403.php');
         exit;
     }
     return $authorized;
 }
开发者ID:hughnguy,项目名称:php,代码行数:37,代码来源:Authentication.php

示例9: autenticacao

 protected function autenticacao($isAjax = false)
 {
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         if ($isAjax) {
             // if is ajax request, let js handle redirect properly ;)
             $session = new Zend_Session_Namespace();
             if (isset($session->url)) {
                 unset($session->url);
             }
             $this->view->error = _("Permission denied.");
             $this->_response->setHttpResponseCode(403);
             return false;
         } else {
             $session = new Zend_Session_Namespace();
             $session->setExpirationSeconds(60 * 60 * 1);
             // 1 minuto
             $session->url = $_SERVER['REQUEST_URI'];
             return $this->_helper->redirector->goToRoute(array(), 'login', true);
         }
     }
     $sessao = Zend_Auth::getInstance()->getIdentity();
     if (!$sessao["administrador"]) {
         if ($this->getRequest()->isXmlHttpRequest()) {
             $this->view->error = _("Unauthorized.");
             $this->_response->setHttpResponseCode(401);
             return false;
         } else {
             return $this->_helper->redirector->goToRoute(array('controller' => 'participante', 'action' => 'index'), 'default', true);
         }
     }
     return true;
 }
开发者ID:jovanepires,项目名称:sige,代码行数:32,代码来源:AdminAction.php

示例10: _initSes

 /**
  * Initialize session
  */
 protected function _initSes()
 {
     $ses = new \Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
     $ses->setExpirationHops(5, null, true);
     $ses->setExpirationSeconds(60 * 60 * 24);
     $this->_ses = $ses;
 }
开发者ID:raspi,项目名称:zf1-fb-auth,代码行数:10,代码来源:Zf1auth_PersistentDataHandler.php

示例11: logarAction

 public function logarAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $resposta = array();
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('sca_usuario')->setIdentityColumn('login_usuario')->setCredentialColumn('password_usuario')->getDbSelect()->join(array('g' => 'sca_grupo'), 'g.id_grupo = sca_usuario.id_grupo', array('nm_grupo', 'is_root'));
     $authAdapter->setIdentity($this->getRequest()->getParam('login_usuario'))->setCredential($this->getRequest()->getParam('password_usuario'))->setCredentialTreatment('MD5(?) and st_usuario = 1');
     //Realiza autenticacao
     $result = $authAdapter->authenticate();
     //Verifica se a autenticacao foi validada
     if ($result->isValid()) {
         //obtem os dados do usuario
         $usuario = $authAdapter->getResultRowObject();
         //Armazena seus dados na sessao
         $storage = Zend_Auth::getInstance()->getStorage();
         $storage->write($usuario);
         // se não for para lembrar os dados expira a sessao em 30 minutos
         if (!$this->getRequest()->getParam('lembrar')) {
             $session = new Zend_Session_Namespace('Zend_Auth');
             $session->setExpirationSeconds(1800);
         }
         //Redireciona para o Index
         $resposta['situacao'] = "success";
         $resposta['msg'] = "Logando aguarde...";
     } else {
         $resposta['situacao'] = "error";
         $resposta['msg'] = "Usuário inativo ou senha incorreta.";
     }
     echo json_encode($resposta);
 }
开发者ID:powman,项目名称:zfpadrao,代码行数:32,代码来源:IndexController.php

示例12: init

 public function init()
 {
     $langNamespace = new Zend_Session_Namespace('Lang');
     $config = Zend_Registry::get('config');
     if ($langNamespace->lang == null) {
         //$config = Zend_Registry::get('config');
         $defaultLanguage = strval($config->framework->language->default);
         $langNamespace->lang = $defaultLanguage;
     }
     $this->view->home = $config->app->home;
     $this->view->joomlahome = $config->joomla->home;
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $this->_currentUser = $authNamespace->user;
         //2011-04-08 ham.bao separate the sessions with admin
         $this->_currentAdmin = $authNamespace->admin;
         $this->_currentClient = $authNamespace->client;
         $this->view->currentUser = $this->_currentUser;
         $authNamespace->setExpirationSeconds(12 * 60 * 60);
     }
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('adminajax', 'json')->initContext();
     $this->initView();
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:25,代码来源:MyController.php

示例13: submitAction

 /**
  * When the user actually submits their otp, this authenticates it.
  */
 public function submitAction()
 {
     $this->disableLayout();
     $this->disableView();
     Zend_Session::start();
     $mfaSession = new Zend_Session_Namespace('Mfa_Temp_User');
     $user = $mfaSession->Dao;
     if (!isset($user) || !$user) {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Session has expired, refresh and try again'));
         return;
     }
     $otpDevice = $this->Mfa_Otpdevice->getByUser($user);
     if (!$otpDevice) {
         throw new Zend_Exception('User does not have an OTP device');
     }
     $token = $this->getParam('token');
     try {
         $valid = $this->ModuleComponent->Otp->authenticate($otpDevice, $token);
     } catch (Zend_Exception $exc) {
         $this->getLogger()->crit($exc->getMessage());
         echo JsonComponent::encode(array('status' => 'error', 'message' => $exc->getMessage()));
         return;
     }
     if ($valid) {
         session_start();
         $authUser = new Zend_Session_Namespace('Auth_User');
         $authUser->setExpirationSeconds(60 * Zend_Registry::get('configGlobal')->session->lifetime);
         $authUser->Dao = $user;
         $authUser->lock();
         $this->getLogger()->debug(__METHOD__ . ' Log in : ' . $user->getFullName());
         echo JsonComponent::encode(array('status' => 'ok'));
     } else {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Incorrect token'));
     }
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:38,代码来源:LoginController.php

示例14: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $params = $request->getParams();
     $auth = Zend_Auth::getInstance();
     Zend_Registry::set('Zend_Auth', $auth);
     if ($auth->hasIdentity()) {
         $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
         $identity = $auth->getIdentity();
         $userDb = new Users_Model_DbTable_User();
         $user = array('id' => $identity->id, 'username' => $identity->username, 'name' => $identity->name, 'email' => $identity->email, 'clientid' => $identity->clientid);
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $authNamespace->user = $user['username'];
         if ($_SESSION['__ZF']['Zend_Auth']['ENT'] - time() < 3600) {
             $authNamespace->setExpirationSeconds(3600);
         }
         Zend_Registry::set('User', $user);
         $view->user = $user;
         $clientDb = new Application_Model_DbTable_Client();
         $client = $clientDb->getClient($user['clientid']);
         Zend_Registry::set('Client', $client);
     } elseif ($params['module'] != 'users' && $params['action'] != 'login') {
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         if (isset($params['id']) && $params['id']) {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action'] . '|' . $params['id']));
         } else {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action']));
         }
     }
 }
开发者ID:dewawi,项目名称:dewawi,代码行数:29,代码来源:Auth.php

示例15: loginAction

 public function loginAction()
 {
     if (!$this->getRequest()->isPost()) {
         return $this->_forward('index');
     }
     $form = $this->getForm();
     if (!$form->isValid($_POST)) {
         // Falla la validación; Se vuelve a mostrar el formulario
         $this->view->form = $form;
         return $this->render('form');
     }
     $username = $form->getValue('username');
     $password = $form->getValue('password');
     $remember = $form->getValue('remember');
     $usuario = new Application_Model_Usuario();
     $result = $usuario->validarLogin($username, $password);
     if (!$result->isValid()) {
         // Autenticación fallida, imprime el porque
         return $this->_redirect('/');
     } else {
         $usuario->setIdUsuario($result->getIdentity());
         $mysession = new Zend_Session_Namespace('sesion');
         $mysession->actividad = 'SI';
         $mysession->setExpirationSeconds(60 * 5, 'actividad');
         //$mysession->usuario_id =  $usuario->getIdUsuario();
         $mysession->usuario_nombre = $result->getIdentity();
         $_SESSION['username'] = strtoupper($mysession->usuario_nombre);
         $aux = $usuario->getUsuariobyNombreUsuario($mysession->usuario_nombre);
         $mysession->usuario_id = $aux[0]['iUsuIdUsuario'];
         $mysession->tipo_usuario = $aux[0]['TipoUsuario_iTiUsuarioIdTipoUsuario'];
         $log = new Application_Model_Logs();
         $log->crearLog('A');
         $this->redireccionar();
     }
 }
开发者ID:renzot23,项目名称:Los-Pinos-Virtual,代码行数:35,代码来源:IndexController.php


注:本文中的Zend_Session_Namespace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。