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


PHP Zend_Auth_Storage_Session::write方法代码示例

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


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

示例1: loginAction

 public function loginAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $storage = new Zend_Auth_Storage_Session();
         $storage->clear();
     }
     $users = new Application_Model_User();
     $form = new Application_Form_Login();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), 'user');
             $authAdapter->setIdentityColumn('name')->setCredentialColumn('password');
             $authAdapter->setIdentity($data['name'])->setCredential($data['password']);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $storage = new Zend_Auth_Storage_Session();
                 $storage->write($authAdapter->getResultRowObject(array('id', 'name', 'image')));
                 if ($auth->getIdentity()->name == 'admin') {
                     $this->redirect("Order/adminhome");
                 } elseif ($auth->getIdentity()->name != 'admin') {
                     $this->redirect("Order/adduserorder");
                 }
             } else {
                 $this->view->errorMessage = "Invalid username or password. Please try again.";
             }
         }
     }
 }
开发者ID:nguyenkiet,项目名称:cafeteria,代码行数:32,代码来源:AuthController.php

示例2: login

 /**
  * Login
  *
  * @param  array $data 
  * @return array 
  */
 public function login($data)
 {
     foreach ($data as $param) {
         if ($param == null || $param == '') {
             $return['status'] = 0;
             $return['message'] = 'Please, fill all the fields.';
             return $return;
         }
     }
     $storage = new Zend_Auth_Storage_Session('www.beyourlight.co.uk');
     $auth = Zend_Auth::getInstance();
     $authAdapter = $this->getAuthAdapter();
     $authAdapter->setIdentity($data['Username'])->setCredential($data['Password']);
     $result = $auth->authenticate($authAdapter)->isValid();
     $storage->write($authAdapter->getResultRowObject(array('UserID', 'FirstName', 'LastName', 'Username', 'Role')));
     $message = '. User agent: ' . $_SERVER['HTTP_USER_AGENT'];
     if ($result) {
         // update last login
         $currentTime = Site_View_Helper_Date::formatDate();
         $data = array();
         $data['LastLoginDate'] = $currentTime;
         $this->updateUser($data);
         // register in access log and forward to home
         $this->_accessLog->insertAccessLog($storage->read()->Username, Enum_ActivityType::Login, $message);
         $return['status'] = 1;
     } else {
         // register in access log
         $this->_accessLog->insertAccessLog($data['Username'], Enum_ActivityType::FailedLogin, $message);
         $return['status'] = 0;
         $return['message'] = "Invalid username or password. Please try again.";
     }
     return $return;
 }
开发者ID:Ewaldaz,项目名称:Be-your-light,代码行数:39,代码来源:User.php

示例3: indexAction

 public function indexAction()
 {
     $storage = new Zend_Auth_Storage_Session('admin_type');
     $data = $storage->read();
     if ($data && $data != null) {
         $this->_redirect('admin/');
     }
     $this->view->messages = $this->_flashMessenger->getMessages();
     //$this->_helper->layout()->disableLayout();
     $this->_helper->layout()->setLayout('adminlogin');
     $users = new Admin_Model_DbTable_AdminUsers();
     if ($this->getRequest()->isPost()) {
         $formdata = $this->getRequest()->getPost();
         $enc_pwd = md5($formdata['user_password']);
         //print_r($formdata);exit;
         $auth = Zend_Auth::getInstance();
         $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), TBL_ADMIN);
         $authAdapter->setIdentityColumn('user_name')->setCredentialColumn('user_password');
         $authAdapter->setIdentity($formdata['user_name'])->setCredential($enc_pwd);
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             $storage = new Zend_Auth_Storage_Session('admin_type');
             $storage->write($authAdapter->getResultRowObject());
             $this->_redirect('admin/');
         } else {
             $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
         }
     }
 }
开发者ID:vmangla,项目名称:evendor,代码行数:29,代码来源:AuthController.php

示例4: write

 public function write($contents)
 {
     if (!$this->_session) {
         $this->_session = new Zend_Session_Namespace($this->_namespace);
     }
     parent::write($contents);
 }
开发者ID:shevron,项目名称:stoa,代码行数:7,代码来源:LazySession.php

示例5: indexAction

 public function indexAction()
 {
     if (!empty($this->sessUserInfo)) {
         $this->_redirect('user/');
     }
     //$this->_helper->layout()->setLayout('publisherlogin');
     $this->view->messages = $this->_flashMessenger->getMessages();
     $formData = array();
     $formErrors = array();
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         //print_r($formData);exit;
         if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
             $formErrors['user_name'] = "Please enter your username";
         }
         if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
             $formErrors['user_password'] = "Please enter your password";
         }
         if (count($formErrors) == 0) {
             //echo md5($formData['user_password']);
             $user_pwd = md5($formData['user_password']);
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($this->modelCompanies->getAdapter(), TBL_COMPANIES);
             $authAdapter->setIdentityColumn('user_email')->setCredentialColumn('user_password');
             $authAdapter->setIdentity($formData['user_name'])->setCredential($user_pwd);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $userInfo = $authAdapter->getResultRowObject();
                 if ($userInfo->account_type == '2' || $userInfo->account_type == '3') {
                     //AND parent_id=0
                     if ($this->modelCompanies->isExist('status=1  and id=' . $userInfo->id)) {
                         $storage = new Zend_Auth_Storage_Session('account_type');
                         $storage->write($userInfo);
                         $this->_redirect('user/');
                     } else {
                         if ($this->modelCompanies->isExist('status=1 AND parent_id>0 and id=' . $userInfo->id)) {
                             $this->view->errorMessage = '<div class="div-error">You can only login through mobile app.</div>';
                         } else {
                             $this->view->errorMessage = '<div class="div-error">Sorry, user is not active</div>';
                         }
                     }
                 } else {
                     $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
                 }
             } else {
                 $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
             }
         } else {
             $this->view->errorMessage = '<div class="div-error">Please enter username and password</div>';
         }
     }
     $sessionMsg = new Zend_Session_Namespace('step1Msg');
     $sessionMsg->formData = $formData;
     $sessionMsg->formErrors = $formErrors;
     $sessionMsg->errorMessage = $this->view->errorMessage;
     //$this->_redirect('/');
 }
开发者ID:vmangla,项目名称:evendor,代码行数:57,代码来源:AuthController.php

示例6: indexAction

 public function indexAction()
 {
     if (!empty($this->sessPublisherInfo)) {
         $this->_redirect('publisher/');
     }
     //$this->_helper->layout()->setLayout('publisherlogin');
     $this->view->messages = $this->_flashMessenger->getMessages();
     $formData = array();
     $formErrors = array();
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         //print_r($formData);exit;
         if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
             $formErrors['user_name'] = "Please enter your username";
         }
         if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
             $formErrors['user_password'] = "Please enter your password";
         }
         if (count($formErrors) == 0) {
             $usermailID = trim($formData['user_name']);
             $getLoginRecord = $this->modelPublishers->getInfoByLoginEmail($usermailID);
             if (count($getLoginRecord) > 0) {
                 for ($countUser = 0; $countUser < count($getLoginRecord); $countUser++) {
                     if ($getLoginRecord[$countUser]['user_type'] != 'author') {
                         $auth = Zend_Auth::getInstance();
                         $authAdapter = new Zend_Auth_Adapter_DbTable($this->modelPublishers->getAdapter(), TBL_PUBLISHERS);
                         $authAdapter->setIdentityColumn('emailid')->setCredentialColumn('password');
                         $authAdapter->setIdentity($formData['user_name'])->setCredential(md5($formData['user_password']));
                         $authAdapter->getDbSelect()->where('user_type="' . $getLoginRecord[$countUser]['user_type'] . '"');
                         $result = $auth->authenticate($authAdapter);
                         if ($result->isValid()) {
                             $userInfo = $authAdapter->getResultRowObject();
                             if ($this->modelPublishers->isExist('profile_status=1 AND id=' . $userInfo->id)) {
                                 $storage = new Zend_Auth_Storage_Session('publisher_type');
                                 $storage->write($userInfo);
                                 $this->_redirect('publisher/');
                             } else {
                                 $this->view->errorMessage = '<div class="div-error">Sorry, user is not active</div>';
                             }
                         } else {
                             $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
                         }
                     }
                 }
             } else {
                 $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
             }
         } else {
             $this->view->errorMessage = '<div class="div-error">Please enter username and password</div>';
         }
     }
     $sessionMsg = new Zend_Session_Namespace('step1Msg');
     $sessionMsg->formData = $formData;
     $sessionMsg->formErrors = $formErrors;
     $sessionMsg->errorMessage = $this->view->errorMessage;
     //$this->_redirect('/');
 }
开发者ID:vmangla,项目名称:evendor,代码行数:57,代码来源:AuthController.php

示例7: loginUser

 public function loginUser($data)
 {
     $id = $this->getIdByUsername($data['username']);
     $user = $this->find((int) $id)->current();
     $salt = $user['password_salt_usr'];
     $auth = Zend_Auth::getInstance();
     $authAdapter = new Zend_Auth_Adapter_DbTable($this->getAdapter(), 'users_usr');
     $authAdapter->setIdentityColumn('login_name_usr')->setCredentialColumn('password_usr');
     $authAdapter->setIdentity($data['username'])->setCredential(md5($salt . $data['password'] . $salt));
     $result = $auth->authenticate($authAdapter);
     if ($result->isValid()) {
         $storage = new Zend_Auth_Storage_Session();
         $storage->write($authAdapter->getResultRowObject());
         return true;
     }
     return false;
 }
开发者ID:jannev,项目名称:site,代码行数:17,代码来源:User.php

示例8: indexAction

 public function indexAction()
 {
     //$this->_helper->layout()->disableLayout();
     //$this->_helper->layout()->setLayout('companylogin');
     $this->view->messages = $this->_flashMessenger->getMessages();
     $formData = array();
     $formErrors = array();
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         //print_r($formData);exit;
         if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
             $formErrors['user_name'] = "Please enter your username";
         }
         if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
             $formErrors['user_password'] = "Please enter your password";
         }
         if (count($formErrors) == 0) {
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($this->modelCompanies->getAdapter(), TBL_COMPANIES);
             $authAdapter->setIdentityColumn('user_email')->setCredentialColumn('user_password');
             $authAdapter->setIdentity($formData['user_name'])->setCredential($formData['user_password']);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $userInfo = $authAdapter->getResultRowObject();
                 if ($this->modelCompanies->isExist('status=1 AND id=' . $userInfo->id)) {
                     $storage = new Zend_Auth_Storage_Session('company_type');
                     $storage->write($userInfo);
                     $this->_redirect('company/');
                 } else {
                     $this->view->errorMessage = '<div class="div-error">Sorry, user is not active</div>';
                 }
             } else {
                 $this->view->errorMessage = '<div class="div-error">Invalid username or password</div>';
             }
         } else {
             $this->view->errorMessage = '<div class="div-error">Please enter username and password</div>';
         }
     }
     $sessionMsg = new Zend_Session_Namespace('companyStep1Msg');
     $sessionMsg->formData = $formData;
     $sessionMsg->formErrors = $formErrors;
     $sessionMsg->errorMessage = $this->view->errorMessage;
     //$this->_redirect('/'); /uncomment this if you want to login from front
 }
开发者ID:vmangla,项目名称:evendor,代码行数:44,代码来源:AuthController_22052013.php

示例9: loginAction

 public function loginAction()
 {
     $goto = $this->getRequest()->getParam('goto');
     if (@$this->_me) {
         if ($goto) {
             $this->_redirect("/{$goto}");
         } else {
             $this->redirect("/track");
         }
     }
     $this->view->goto = $goto;
     if ($this->getRequest()->isPost()) {
         //Get form data from post array
         $data = $this->_request->getPost();
         if ($data['email'] == '' || $data['password'] == '') {
             $this->view->error = "Please provide your email address and password.";
             return false;
         }
         //Log user in to session
         $users = new Users();
         $auth = Zend_Auth::getInstance();
         $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), 'users');
         $authAdapter->setIdentityColumn('email')->setCredentialColumn('password');
         $authAdapter->setIdentity($data['email'])->setCredential(sha1($data['password']));
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             Zend_Session::rememberMe(31536000);
             $credentials = base64_encode(serialize(array('email' => $data['email'], 'password' => sha1($data['password']))));
             //Set login cookie
             setcookie('autl', $credentials, time() + 31536000, '', '.' . $_SERVER['HTTP_HOST']);
             $storage = new Zend_Auth_Storage_Session();
             $storage->write($authAdapter->getResultRowObject());
             $this->_redirect($data['goto']);
         } else {
             $this->view->error = "Invalid email or password. Please try again.";
         }
     }
 }
开发者ID:tolya199178,项目名称:swift,代码行数:38,代码来源:IndexController.php

示例10: loginAction

 public function loginAction()
 {
     $users = new Application_Model_DbTable_Users();
     $form = new Application_Form_LoginForm();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $auth = Zend_Auth::getInstance();
             $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), 'users');
             $authAdapter->setIdentityColumn('username')->setCredentialColumn('password');
             $authAdapter->setIdentity($data['username'])->setCredential($data['password']);
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $storage = new Zend_Auth_Storage_Session();
                 $storage->write($authAdapter->getResultRowObject());
                 $this->_redirect('auth/home');
             } else {
                 $this->view->errorMessage = "Invalid username or password. Please try again.";
             }
         }
     }
 }
开发者ID:narada,项目名称:rate-comments,代码行数:23,代码来源:AuthController.php

示例11: _process

 /**
  * @param values
  * function to check whether emailaddress and password valid or not
  * if it is valid user enters to his/her account
  */
 protected function _process($values)
 {
     $adapter = $this->_getAuthAdapter();
     $userMapper = new User_Model_ClientDataMapper();
     $passPhrase = $userMapper->getUserPassPhrase($values['emailAddress']);
     if ($passPhrase) {
         $passwordHash = sha1($values['password'] . $passPhrase->usrpassphrase);
         $email = strtolower($values['emailAddress']);
         $adapter->setIdentity(trim($email))->setCredential($passwordHash);
         $auth = Zend_Auth::getInstance();
         try {
             $select = $adapter->getDbSelect();
             $select->where('usruser_status_id = 1');
             $result = $auth->authenticate($adapter);
         } catch (Zend_Exception $ex) {
             $this->view->errorMsg = $ex->getMessage() . "<br>";
             Rdine_Logger_FileLogger::info($ex->getMessage());
             throw new Exception($ex->getMessage());
         }
         if ($result->isValid()) {
             $data = $adapter->getResultRowObject();
             $loginProfile = $userMapper->getLoginProfile($data);
             $storage = new Zend_Auth_Storage_Session();
             $data = $storage->read();
             $namespace = new Zend_Session_Namespace();
             $loginProfile['lang'] = $namespace->lang;
             $storage->write($loginProfile);
             $userType = $loginProfile['Usertype'];
             if (($userType == "ADU" || $userType == "RSO" || $userType == "RSU" || $userType == "SRU" || $userType == "CUS") && $loginProfile['companyid'] != 1) {
                 /*$companyMapper = new Administrator_Model_CompanyDataMapper();
                 		$status = $companyMapper->getComapnyStatusById($loginProfile['companyid']);
                 		if($status == true){*/
                 $loginRes = array('Status' => true, 'Usertype' => $userType, 'loginprofile' => $loginProfile);
                 /*}else{
                 			$auth->clearIdentity();
                 			return $loginRes = array('Status'=>false,'CompanyInActive'=>true);
                 		}*/
                 return $loginRes;
             } else {
                 $loginRes = array('Status' => true, 'Usertype' => $userType, 'loginprofile' => $loginProfile);
             }
             //$LoginAttemptMapper = new User_Model_LoginAttemptsDataMapper();
             //$LoginAttemptMapper->UpdateLoginAttempts($data['Email']);
             return $loginRes;
         } else {
             $userMapper = new User_Model_ClientDataMapper();
             $userstatus = $userMapper->getUserStatusByEmail($values['emailAddress']);
             if ($userstatus['userstatusid'] == 3) {
                 return $loginRes = array('Status' => false, 'UserNotApproved' => true);
             } else {
                 if ($userstatus['userstatusid'] == 2) {
                     return $loginRes = array('Status' => false, 'UserInActive' => true);
                 } else {
                     return $loginRes = array('Status' => false, 'isFormValid' => true);
                 }
             }
         }
     } else {
         return $loginRes = array('Status' => false, 'isFormValid' => true);
     }
 }
开发者ID:nightraiser,项目名称:rdine,代码行数:66,代码来源:Client.php

示例12: AddSubscribedRestaurant


//.........这里部分代码省略.........
             }
             $latlong = '';
             if ((int) $formData['cantfind'] < 2) {
                 /* Reterving City By Id */
                 $cityModel = new Application_Model_City();
                 $cityMapper = new Application_Model_CityDataMapper();
                 $cityModel->setId($formData['resCity']);
                 $cityObj = $cityMapper->getCityById($cityModel);
                 $restaddress .= ", " . $cityObj->getDescription();
                 $latlong = Rdine_Geocode_GeocodingAdapter::getGeocodedLatitudeAndLongitude($restaddress);
             }
             if (!$formData['restLatitude'] == NULL && !$formData['restLongitude'] == NULL) {
                 $googlemapstatus = 'TRUE';
             } else {
                 $googlemapstatus = 'FALSE';
             }
             if ($googlemapstatus == 'TRUE') {
                 $latitude = $formData['restLatitude'];
                 $longitude = $formData['restLongitude'];
             } else {
                 $latitude = NULL;
                 $longitude = NULL;
             }
             $resgoogleimage = Rdine_Geocode_GeocodingAdapter::getGoogleRestaurantImage($latitude, $longitude);
             $categoryModel = new Application_Model_RestaurantCategory();
             $categoryMapper = new Application_Model_RestaurantCategoryDataMapper();
             $categoryModel->setCode('SUB');
             $categoryObj = $categoryMapper->getIdByCode($categoryModel);
             if ($data['Usertype'] == "ADM" || $data['Usertype'] == "ADU") {
                 $restaurant->setRestaurantownerid($formData['restowner'])->setcompanyid($data['companyid']);
             } else {
                 $restaurant->setRestaurantownerid($formData['restowner'])->setcompanyid(1);
             }
             $restaurant->setRestaurantname($formData['restName'])->setRescapacity($formData['rescapacity'])->setRestemail($formData['emailAddress'])->setMaxpax($formData['maxpax'])->setRestaddress($formData['resAddress'])->setReststateid($formData['resState'])->setRestRegion($formData['resRegion'])->setRestCity($formData['resCity'])->setCantFindState($formData['cantfindstate'])->setCantFindRegion($formData['cantfindregion'])->setCantFindCity($formData['cantfindcity'])->setCantFindNeighbour($formData['cantfindneigh'])->setCantFind($formData['cantfind'])->setRestPaymentMode($resPaymentMode)->setResttypeid($cusisneTypeObj)->setResttimezone($formData['restimezone'])->setRestPrice($formData['resprice'])->setRestneighboorhood($formData['resNeighbour'])->setRestzipcode($formData['postalCode'])->setres_country_code($formData['countryCode'])->setRestphone($formData['resPhone'])->setRestfax($formData['resFax'])->setRestwebsite($formData['resWebsite'])->setRestmanagername($formData['resManager'])->setRestdesc($formData['resDescription'])->setRestDiningStyle($formData['restDiningStyle'])->setRestParking($formData['restParking'])->setRestParkDetails($formData['restParkDetails'])->setRestPrivParty($formData['restPrivParty'])->setRestPrivPartyContact($formData['restPrivPartyContact'])->setRestAdditDet($formData['restAdditDetails'])->setRestEntertainment($formData['restEntertainment'])->setRestsubforreservation('TRUE')->setReststatus(1)->setRestverifiedstatus(3)->setRestCreatedOn(date('Y-m-d H:i:s'))->setRestLatitude($latitude)->setRestLongtitude($longitude)->setRestGoogleMapStatus($googlemapstatus)->setRestGoogleImage($resgoogleimage)->setRestTimings($formData['restTimings'])->setRestCategory($categoryObj->getId())->setResCreatedDate(date('Y-m-d H:i:s'))->setRestCreatedBy($data['User_Id'])->setreslandmark($formData['restLandMark'])->setres_delevery($formData['restDelevery'])->setreslunch_buffet($formData['restLunchBuffet'])->setresdinner_buffet($formData['restDinnerBuffet'])->setres_wifi($formData['restWifi'])->setres_alcohol($formData['restAlcohol'])->setres_smoking($formData['restSmoke'])->setres_ac($formData['restAC'])->setres_catering($formData['restCatering'])->setres_kids_section($formData['restKidsSection'])->setres_party_allowed($formData['restPrivParty'])->setres_meal_category($formData['restMealType'])->setres_new_tag($formData['restnewtag'])->settag_id($tagid);
             if ($formData['restAvgMealPriceMax'] == '') {
                 $restaurant->setresavg_mealprice_max(0);
             } else {
                 $restaurant->setresavg_mealprice_max($formData['restAvgMealPriceMax']);
             }
             if ($formData['restAvgMealPriceMin'] == '') {
                 $restaurant->setresavg_mealprice_min(0);
             } else {
                 $restaurant->setresavg_mealprice_min($formData['restAvgMealPriceMin']);
             }
             $mapper = new FirmManagement_Model_FirmDataMapper();
             $status = $mapper->addRestaurant($restaurant);
             $restid = $status['resid'];
             $ownerid = $restaurant->getRestaurantaownerid();
             $mapper = new User_Model_ManagerDataMapper();
             $status = $mapper->addPresid($restid, $ownerid);
             $storage = new Zend_Auth_Storage_Session();
             $userdata = $storage->read();
             $userdata['RestId'] = $restid;
             if ($userdata['Usertype'] == 'RSO') {
                 $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                 $restNameByOwnObj->setRestOwnerId($userdata['User_Id']);
                 $restMapper = new FirmManagement_Model_FirmDataMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 $userdata['restList'] = $restList;
             } else {
                 $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                 $restNameByOwnObj->setRestId($restid);
                 $restMapper = new FirmManagement_Model_FirmDataMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 $userdata['restList'] = $restList;
             }
             $storage->write($userdata);
             $folderRename = rename("images/restaurant_images/{$restname}/", "images/restaurant_images/{$restid}/");
             $imagepath = null;
             $logopath = null;
             if ($paths) {
                 $imagepath = $paths['imagepath'];
                 $logopath = $paths['logopath'];
                 $imagelogoRename = '/' . $restname . '/';
                 $restid = $restid;
                 $imageRename = str_replace($imagelogoRename, '/' . $restid . '/', $imagepath);
                 $logoRename = str_replace($imagelogoRename, '/' . $restid . '/', $logopath);
                 $mapper1 = new FirmManagement_Model_FirmDataMapper();
                 $result = $mapper1->Updateimglogo($restid, $imageRename, $logoRename);
             }
             return $result;
         } else {
             $formData = $form->getValues();
             $form->populate($data);
             if ($regionBd) {
                 $form->resRegion->addMultiOptions($regionBd);
             }
             if ($cityBd) {
                 $form->resCity->addMultiOptions($cityBd);
             }
             if ($ngbhBd) {
                 $form->resNeighbour->addMultiOptions($ngbhBd);
             }
             return false;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
开发者ID:nightraiser,项目名称:rdine,代码行数:101,代码来源:Administrator.php

示例13: _writeSession

 public function _writeSession()
 {
     $user = serialize($this->_sessionData);
     if (extension_loaded('mhash')) {
         $hmac = bin2hex(mhash(MHASH_SHA1, $user, $this->_pSalt));
         $user = $hmac . $user;
     }
     parent::write($user);
 }
开发者ID:roycocup,项目名称:Tests,代码行数:9,代码来源:Db.php

示例14: loginajaxAction

 function loginajaxAction()
 {
     $this->_helper->layout->disableLayout();
     $this->modelCompanies = new Company_Model_DbTable_Companies();
     $redirect_url = $_SERVER['HTTP_REFERER'];
     $formData = $this->getRequest()->getPost();
     /*echo "<pre>";
     		print_r($formData);
     		exit;*/
     if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
         echo "Please enter your username/password";
     }
     if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
         echo "Please enter your username/password";
     }
     if (count($formErrors) == 0) {
         $comp_pwd = md5($formData['user_password']);
         $auth = Zend_Auth::getInstance();
         $authAdapter = new Zend_Auth_Adapter_DbTable($this->modelCompanies->getAdapter(), TBL_COMPANIES);
         $authAdapter->setIdentityColumn('user_email')->setCredentialColumn('user_password');
         $authAdapter->setIdentity($formData['user_name'])->setCredential($comp_pwd);
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             $userInfo = $authAdapter->getResultRowObject();
             if ($userInfo->account_type == '1') {
                 $storage = new Zend_Auth_Storage_Session('company_type');
                 $storage->write($userInfo);
                 //header("Location:$redirect_url");
                 echo "s";
             } elseif ($userInfo->account_type == '2') {
                 $storage = new Zend_Auth_Storage_Session('account_type');
                 $storage->write($userInfo);
                 echo "s";
             } elseif ($userInfo->account_type == '3') {
                 $storage = new Zend_Auth_Storage_Session('account_type');
                 $storage->write($userInfo);
                 echo "s";
             }
         } else {
             echo "Invalid username or password";
         }
     }
     exit;
 }
开发者ID:vmangla,项目名称:evendor,代码行数:44,代码来源:AuthController.php

示例15: createsubscribedfirmAction

 public function createsubscribedfirmAction()
 {
     try {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $storage = new Zend_Auth_Storage_Session();
             $data = $storage->read();
             $this->_helper->layout()->setLayout('adminlayout');
             $request = $this->getRequest();
             /* Populating Restaurant owners */
             $resownerMapper = new User_Model_ManagerDataMapper();
             $resOwners = $resownerMapper->fetchAll();
             $this->view->resowners = $resOwners;
             $userservice = new Application_Service_Client();
             $form = $userservice->getRestaurantOwnerForm();
             $this->view->form = $form;
             //				$CountryCodeMapper = new Application_Model_CountryCodeDataMapper();
             //		    	$CountryCode = $CountryCodeMapper->fetchAll();
             //		    	$CodeList = array();
             //		    	$CodeList[] = array('key'=>'','value'=>'Select Country Flag');
             //		    	foreach($CountryCode as $listcode){
             //		    		$CodeList[] = array('key'=>$listcode->getCountry_dial_code(),'value'=>$listcode->getCountry_flag());
             //		    	}
             //		    	$this->view->codelist = $CodeList;
             if (isset($request->userid)) {
                 $data['restownerId'] = $request->userid;
                 $rsoMapper = new User_Model_ManagerDataMapper();
                 $table = $rsoMapper->getDbTable();
                 $select = $table->select();
                 $select->setIntegrityCheck(false);
                 $select->from($table, array('rsofk_salution', 'rsofirst_name', 'rsolast_name', 'rsophone', 'rsostateid', 'rsocityid', 'rsoregionid', 'rso_companyid', 'presid', 'defaultview'))->join(array('rd.restaurant_details'), 'resfk_user = rsofk_user', array('resid'))->where('rsofk_user = ?', $request->userid)->where('resstatus = ?', 1);
                 $row = $table->fetchRow($select);
                 if ($row->resid != null) {
                     if ($row->presid != null) {
                         $data['RestId'] = $row->presid;
                     } else {
                         $data['RestId'] = $row->resid;
                     }
                     $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                     $restNameByOwnObj->setRestOwnerId($request->userid);
                     $restMapper = new FirmManagement_Model_FirmDataMapper();
                     $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                     $data['restList'] = $restList;
                 } else {
                     $data['RestId'] = "";
                     $data['restList'] = "";
                 }
                 $storage->write($data);
                 if ($data['companyid'] != 6) {
                     return $this->_helper->redirector('addfirm', 'Firm', 'FirmManagement');
                 } else {
                     return $this->_helper->redirector('addroundmenufirm', 'Firm', 'FirmManagement');
                 }
             } else {
                 if ($this->getRequest()->isPost()) {
                     $result = $userservice->RegisterRestaurantOwner($this->getRequest()->getPost());
                     if ($result['status']) {
                         $data['restownerId'] = $result['userid'];
                         $storage->write($data);
                         if ($data['companyid'] != 6) {
                             return $this->_helper->redirector('addfirm', 'Firm', 'FirmManagement');
                         } else {
                             return $this->_helper->redirector('addroundmenufirm', 'Firm', 'FirmManagement');
                         }
                     } else {
                         if ($result['form']) {
                             $this->view->form = $result['form'];
                             $this->view->errors = $form;
                         }
                     }
                 }
             }
         } else {
             $this->_redirect($this->view->url(array('module' => 'User', 'controller' => 'Login', 'action' => 'signin'), 'login', true));
         }
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
开发者ID:nightraiser,项目名称:rdine,代码行数:79,代码来源:AdministratorController.php


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