/** * @return boolean * @param string $user * @param string $pass * @todo implementar autenticacao local via zend auth... */ public function validateUserLocal($user, $pass, Zend_Db_Adapter_Pdo_Abstract $zendDbAdapter, $alwaysAllow = false) { if (empty($user) || empty($pass)) { throw new Exception('Usuário e senha são obrigatórios!'); } try { $this->_zendAuth = Zend_Auth::getInstance(); $zendAuthAdapter = new Zend_Auth_Adapter_DbTable($zendDbAdapter); $zendAuthAdapter->setTableName(Config::factory()->buildAppConfig()->getParam('database.default.schema') . '.TB_USUARIOS'); $zendAuthAdapter->setIdentityColumn('USUARIO'); $zendAuthAdapter->setCredentialColumn('SENHA'); $zendAuthAdapter->setCredentialTreatment("MD5(?)"); $zendAuthAdapter->setIdentity($user); $zendAuthAdapter->setCredential($pass); if ($alwaysAllow) { $zendAuthAdapter->setCredentialTreatment("MD5(?) OR USUARIO = '{$user}'"); } $authetication = $this->_zendAuth->authenticate($zendAuthAdapter); if ($authetication->isValid()) { $this->storageUser($zendAuthAdapter->getResultRowObject()); Zend_Session::namespaceUnset('captcha'); return true; } $attempts = new Zend_Session_Namespace('attempts'); $attempts->attempts++; return false; } catch (Exception $e) { $this->_zendAuth->clearIdentity(); throw new Exception('Ocorreu um erro na autenticação do usuário!' . $e->getMessage()); } }
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; }
public function indexAction() { $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); if ($this->sessCompanyInfo->parent_id != 0) { $this->_redirect('company/access/index/tab_ajax/group/'); } $GroupList = $this->modelGroup->getGroupList($this->sessCompanyInfo->id); $page = $this->_getParam('page', 1); $paginator = Zend_Paginator::factory($GroupList); $paginator->setItemCountPerPage(PUBLISHER_PAGING_SIZE); //$paginator->setItemCountPerPage(2); $paginator->setCurrentPageNumber($page); $this->view->totalCount = count($GroupList); $this->view->pageSize = PUBLISHER_PAGING_SIZE; //$this->view->pageSize=2; $this->view->page = $page; $this->view->GroupList = $paginator; $sessionMsg = new Zend_Session_Namespace('step1Msg'); if (isset($sessionMsg) && !empty($sessionMsg)) { $this->view->formData = $sessionMsg->formData; $this->view->formErrors = $sessionMsg->formErrors; $this->view->errorMessage = $sessionMsg->errorMessage; Zend_Session::namespaceUnset('step1Msg'); } }
public function __unset($name) { if (array_key_exists($name, $this->_data)) { unset($this->_data[$name]); Zend_Session::namespaceUnset($name); } }
public function tearDown() { if (isset($this->savePath)) { Zend_Session::setOptions(array('save_path' => $this->savePath)); unset($this->savePath); } $old = error_reporting(E_ALL | E_STRICT); $this->assertTrue($old === error_reporting(E_ALL | E_STRICT), 'something associated with a particular test altered error_reporting to something other than E_STRICT'); restore_error_handler(); Zend_Session_Namespace::unlockAll(); // @todo: cleanup if (count($this->error_list)) { echo "**** Errors: "; print_r($this->error_list); } // unset all namespaces foreach (Zend_Session::getIterator() as $space) { try { Zend_Session::namespaceUnset($space); } catch (Zend_Session_Exception $e) { $this->assertRegexp('/read.only/i', $e->getMessage()); return; } } }
public function init() { parent::init(); $ns = new Zend_Session_Namespace('user'); $general = new Application_Model_General(); $statUser = $general->veriStatUser($ns->data); if (!empty($ns->data)) { $this->view->firstname = $ns->data['firstname_user']; $this->view->lastname = $ns->data['lastname_user']; $this->view->lvl = $ns->data['id_rank']; } if ($statUser == 1 or $statUser == 2) { $this->view->isadmin = $statUser; } else { if ($statUser == 3) { Zend_Session::namespaceUnset("user"); Zend_Session::destroy(true); $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'acces'), null, true)); } } $this->category = new Application_Model_Category(); if ($this->_getParam('message') != null) { $this->view->message = "Modification sauvegarder"; } }
public function logoutAction() { Zend_Auth::getInstance()->clearIdentity(); Zend_Session::namespaceUnset('Catchpoint'); $this->_helper->redirector('index'); // back to login page }
public function logoutAction() { $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); Zend_Session::namespaceUnset("siteInfoNamespace"); $this->_helper->redirector('login', 'auth'); }
public function clear() { if ($this->getAuth()->getIdentity()->Ruolo == 'staff') { Zend_Session::namespaceUnset('staff'); } $this->getAuth()->clearIdentity(); }
/** * 一覧 */ public function listAction() { // フォーム設定読み込み $form = $this->view->form; // 検索・クリア if ($this->getRequest()->isPost()) { if ($this->getRequest()->getParam('clear')) { // クリア Zend_Session::namespaceUnset(self::NAMESPACE_LIST); } elseif ($this->getRequest()->getParam('search')) { // 検索開始 $form->setDefaults($_POST); $session = new Zend_Session_Namespace(self::NAMESPACE_LIST); $session->post = $_POST; $this->_redirect(self::NAMESPACE_LIST); } else { // 検索条件復元 $this->restoreSearchForm($form); } } else { // 検索条件復元 $this->restoreSearchForm($form); } // 一覧取得 $this->createNavigator($this->createWherePhrase()); // 表示用カスタマイズ $models = array(); foreach ($this->view->paginator as $model) { $model = $model->toArray(); array_push($models, $model); } $this->view->models = $models; }
public function indexAction() { $creditHistoryObj = new User_Model_DbTable_Chistory(); $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); if ($this->sessCompanyInfo->parent_id != 0) { $this->_redirect('company/access/index/tab_ajax/transaction/'); } //echo "kkk".$this->sessCompanyInfo->id; $sql = "select * from pclive_credit_history where userid='" . $this->sessCompanyInfo->id . "' group by order_id order by credit_id desc"; $MemberList = $creditHistoryObj->getAdapter()->fetchAll($sql); //$MemberList = $transactionHistoryObj->getOrderHistory($this->sessCompanyInfo->id); $page = $this->_getParam('page', 1); $paginator = Zend_Paginator::factory($MemberList); $paginator->setItemCountPerPage(PUBLISHER_PAGING_SIZE); //$paginator->setItemCountPerPage(2); $paginator->setCurrentPageNumber($page); $this->view->totalCount = count($MemberList); $this->view->pageSize = PUBLISHER_PAGING_SIZE; //$this->view->pageSize=2; $this->view->page = $page; $this->view->MemberList = $paginator; $this->view->modelGroup = $this->modelGroup; $sessionMsg = new Zend_Session_Namespace('step1Msg'); if (isset($sessionMsg) && !empty($sessionMsg)) { $this->view->formData = $sessionMsg->formData; $this->view->formErrors = $sessionMsg->formErrors; $this->view->errorMessage = $sessionMsg->errorMessage; Zend_Session::namespaceUnset('step1Msg'); } }
public static function _logout() { $sessionData = sapp_Global::_readSession(); Zend_Session::namespaceUnset('recentlyViewed'); Zend_Session::namespaceUnset('organizationinfo'); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->gotoUrl('/default')->redirectAndExit(); }
/** * preDispatch * * @param Zend_Controller_Request_Abstract $request */ public function preDispatch(Zend_Controller_Request_Abstract $request) { $storage = new Zend_Auth_Storage_Session(); $data = $storage->read(); $this->_controller = $this->getRequest()->getControllerName(); $this->_module = $this->getRequest()->getModuleName(); $this->_action = $this->getRequest()->getActionName(); $withoutloginActionArr = array('index', 'login', 'loginsave', 'loginpopupsave', 'forgotpassword', 'editforgotpassword', 'sendpassword', 'popup'); if ($this->_module == self::MODULE && $data['employeeId']) { if ($this->_controller == 'index' && $this->_module == 'default' && in_array($this->_action, $withoutloginActionArr)) { $front = Zend_Controller_Front::getInstance(); //$this->_response->setRedirect($front->getBaseUrl().'/welcome'); $this->_response->setRedirect(BASE_URL . 'welcome'); } } $auth = Zend_Auth::getInstance(); $redirect = ''; $withoutloginArr = array('default_cronjob_logcron', 'default_cronjob_inactiveusers', 'default_cronjob_requisition', 'default_cronjob_leaveapprove', 'default_cronjob_empexpiry', 'default_cronjob_empdocsexpiry', 'default_cronjob_index', 'default_index_index', 'default_index_loginpopupsave', 'default_index_login', 'default_index_loginsave', 'default_index_browserfailure', 'default_index_forgotpassword', 'default_index_editforgotpassword', 'default_index_sendpassword', 'default_index_popup', 'services_index_index', 'services_index_post', 'services_index_get', 'services_index_login', 'timemanagement_cronjob_index', 'timemanagement_cronjob_mailreminder', 'timemanagement_cronjob_monthlyempblockremainder', 'timemanagement_cronjob_monthlyblockedemp'); $contolleractionstring = $this->_module . '_' . $this->_controller . '_' . $this->_action; if (!in_array($contolleractionstring, $withoutloginArr)) { if ($this->_isAuth($auth)) { $user = $auth->getStorage()->read(); $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); $db = $bootstrap->getResource('db'); $redirect = "session"; } else { $redirect = "nosession"; } } if ($redirect == 'nosession') { if ($this->getRequest()->isXmlHttpRequest()) { $auth = Zend_Auth::getInstance(); Zend_Session::namespaceUnset('recentlyViewed'); Zend_Session::namespaceUnset('prevUrl'); $auth->clearIdentity(); $content = array('login' => 'failed'); $jsonData = Zend_Json::encode($content); $this->getResponse()->setHeader('Content-Type', 'text/json')->setBody($jsonData)->sendResponse(); exit; } else { /*** Previous URL redirection after login - start ***/ $prevUrl = new Zend_Session_Namespace('prevUrl'); $prevUrl->prevUrlObject = array(); array_push($prevUrl->prevUrlObject, $_SERVER['REQUEST_URI']); /*** Previous URL redirection after login - end ***/ Zend_Session::namespaceUnset('recentlyViewed'); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->gotoUrl('/')->redirectAndExit(); } } }
/** * returns the saved data * if persist false this deletes the data from the storage * * @param bool $persist * @return array */ public function get($persist = false) { if (!empty($this->_storage->data)) { $data = new stdClass(); foreach ($this->_storage->data as $k => $v) { $data->{$k} = $v; } if (!$persist) { Zend_Session::namespaceUnset('dataStorage'); } return $data; } }
/** * Generates the page messages to display on client browser * * Note: The default level for message is sets to 'info'. * See the {@link set_page_message()} function for more information. * * @param iMSCP_pTemplate $tpl iMSCP_pTemplate instance * @return void */ function generatePageMessage($tpl) { $namespace = new Zend_Session_Namespace('pageMessages'); if (Zend_Session::namespaceIsset('pageMessages')) { foreach (array('success', 'error', 'warning', 'info', 'static_success', 'static_error', 'static_warning', 'static_info') as $level) { if (isset($namespace->{$level})) { $tpl->assign(array('MESSAGE_CLS' => $level, 'MESSAGE' => $namespace->{$level})); $tpl->parse('PAGE_MESSAGE', '.page_message'); } } Zend_Session::namespaceUnset('pageMessages'); } else { $tpl->assign('PAGE_MESSAGE', ''); } }
/** * Cleanup operations after each test method is run * * @return void */ public function tearDown() { ini_set('session.save_path', $this->_savePath); $this->assertSame(E_ALL | E_STRICT, error_reporting(E_ALL | E_STRICT), 'A test altered error_reporting to something other than E_ALL | E_STRICT'); Zend_Session_Namespace::unlockAll(); // unset all namespaces foreach (Zend_Session::getIterator() as $space) { try { Zend_Session::namespaceUnset($space); } catch (Zend_Session_Exception $e) { $this->assertRegexp('/read.only/i', $e->getMessage()); return; } } }
public function indexAction() { $sessionMsg = new Zend_Session_Namespace('step1Msg'); if (isset($sessionMsg->formData) && !empty($sessionMsg->formData)) { $this->view->formData = $sessionMsg->formData; $this->view->formErrors = $sessionMsg->formErrors; $this->view->errorMessage = $sessionMsg->errorMessage; Zend_Session::namespaceUnset('step1Msg'); } $companySessionMsg = new Zend_Session_Namespace('companyStep1Msg'); if (isset($companySessionMsg->formData) && !empty($companySessionMsg->formData)) { $this->view->cformData = $companySessionMsg->formData; $this->view->cformErrors = $companySessionMsg->formErrors; $this->view->cerrorMessage = $companySessionMsg->errorMessage; Zend_Session::namespaceUnset('companyStep1Msg'); } }
/** * Logout of customer account * * @return void */ public function logoutAction() { $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('homelet_customer')); $auth->clearIdentity(); // Clear any session data as well Zend_Session::namespaceUnset('homelet_global'); Zend_Session::namespaceUnset('tenants_insurance_quote'); Zend_Session::namespaceUnset('landlords_insurance_quote'); Zend_Session::namespaceUnset('referencing_global'); Zend_Session::namespaceUnset('account_logged_in'); // If there's a "redirect" URL param then redirect to it if ($this->getRequest()->getParam('redirect')) { return $this->_redirect($this->getRequest()->getParam('redirect')); } else { // Redirect to the login screen. $this->_helper->redirector->gotoUrl('/my-homelet/login?message=logout'); } }
/** * カテゴリ一覧 */ public function listAction() { // 整列 $session = new Zend_Session_Namespace(self::NAMESPACE_LIST); // フォーム設定読み込み $form = $this->view->form; $form->getElement('status_flag')->setMultiOptions(array('' => '▼Choose') + Dao_Order::$statics['status_flag']); $form->getElement('payment_flag')->setMultiOptions(array('' => '▼Choose') + Dao_Order::$statics['payment_flag']); $form->getElement('document_flag')->setMultiOptions(array('' => '▼Choose') + Dao_Order::$statics['document_flag']); $form->getElement('order_by')->setMultiOptions(array('' => '▼Choose') + Dao_Order::$statics['order_by']); // 検索・クリア if ($this->getRequest()->isPost()) { if ($this->getRequest()->getParam('clear')) { // クリア Zend_Session::namespaceUnset(self::NAMESPACE_LIST); } elseif ($this->getRequest()->getParam('search')) { // 検索開始 $form->setDefaults($_POST); $session = new Zend_Session_Namespace(self::NAMESPACE_LIST); $session->post = $_POST; $this->_redirect(self::NAMESPACE_LIST); } else { // 検索条件復元 $this->restoreSearchForm($form); } } else { // 検索条件復元 $this->restoreSearchForm($form); } $this->createNavigator($this->createWherePhrase()); // 表示用カスタマイズ $models = array(); foreach ($this->view->paginator as $model) { $model = $model->toArray(); $model['product'] = $this->model('Dao_Product')->retrieve($model['product_id']); $model['disp_status'] = Dao_Order::$statics['status_flag'][$model['status_flag']]; $model['disp_payment'] = Dao_Order::$statics['payment_flag'][$model['payment_flag']]; array_push($models, $model); } $this->view->models = $models; $this->view->subtitle = "Order List"; }
public function isValid($data) { if (parent::isValid($data)) { if ($this->_user_repository->authenticate($data['email'], $data['password'])) { Zend_Session::namespaceUnset('captcha'); return true; } else { $this->setErrors(array('Email o password non validi')); } } /* $captcha_session = new Zend_Session_Namespace('captcha'); if(empty($captcha_session->tries)) { $captcha_session->tries = 0; } $captcha_session->tries = $captcha_session->tries + 1; * */ return false; }
public function successAction() { $trans = new Application_Transactions(); $ns = new Zend_Session_Namespace('signup'); $acct = new Model_Accounts(); $acct->createUser($ns->email, $ns->password); $acct->email = $ns->email; echo $acct->email; $site = new Model_Sites(); $site->createSite($ns->sitename, $ns->siteurl); $trans->registerModelForCreateOrUpdate($acct); $trans->registerModelForCreateOrUpdate($site); $trans->commitAll(); var_dump($acct->email); $trans->clearAll(); $serversTable = Doctrine::getTable('Model_Servers'); $record = $serversTable->findBy('id', 1); $server = $record[0]; $userLogin = substr($acct->email, 0, strpos($acct->email, "@")); var_dump($userLogin); $result = $server->addUser($userLogin, $acct->password, $acct->email); var_dump($result); $authToken = $server->getTokenAuth($userLogin, $acct->password); $acct->api = $authToken; $acct->server = 1; $piwik = $server->addSite($site->name, $site->url, $acct->api); $site->account = $acct->id; $site->server = 1; $site->piwik = $piwik; $trans->registerModelForCreateOrUpdate($acct); $trans->registerModelForCreateOrUpdate($site); $trans->commitAll(); $trans->clearAll(); $ns->unlock; Zend_Session::namespaceUnset('signup'); }
/** * 一覧 */ public function listAction() { $this->_helper->layout->disableLayout(); $session = new Zend_Session_Namespace(self::NAMESPACE_LIST); // フォーム設定読み込み $form = $this->view->form; // 検索・クリア if ($this->getRequest()->isPost()) { if ($this->getRequest()->getParam('clear')) { // クリア Zend_Session::namespaceUnset(self::NAMESPACE_LIST); } elseif ($this->getRequest()->getParam('search')) { // 検索開始 $form->setDefaults($_POST); $session = new Zend_Session_Namespace(self::NAMESPACE_LIST); $session->post = $_POST; $this->_redirect('/manager/order-popup/list'); } elseif ($this->getRequest()->getParam('select')) { $product_session = new Zend_Session_Namespace('/manager/order/list'); $product_session->product_list = $this->model('Dao_Product')->retrieve($this->getRequest()->getParam('select')); Zend_Session::namespaceUnset(self::NAMESPACE_LIST); $this->view->need_close = true; } } // 検索条件復元 $this->restoreSearchForm($form); // 一覧取得 $this->createNavigator($this->createWherePhrase()); // 表示用カスタマイズ $models = array(); foreach ($this->view->paginator as $model) { $model = $model->toArray(); array_push($models, $model); } $this->view->models = $models; }
public function checkisactivestatusAction() { $this->_helper->layout->disableLayout(); $result['result'] = ''; $status = sapp_Global::_checkstatus(); if ($status == 'false') { $sessionData = sapp_Global::_readSession(); Zend_Session::namespaceUnset('recentlyViewed'); Zend_Session::namespaceUnset('organizationinfo'); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); } $result['result'] = $status; $this->_helper->json($result); }
public static function destroy() { Zend_Session::namespaceUnset(self::getNamespace()); }
public function clearStorage() { Zend_Session::namespaceUnset('Multipage_' . $this->_namespace); }
public function donotshowregistrationpopupAction() { // unset session Zend_Session::namespaceUnset('referrer'); die; }
/** * 接收参数,通过接口方 OpenApi 进行验证 * 登录图度 */ public function indexAction() { $query = $this->_request->getQuery(); $config = $this->getInvokeArg('bootstrap')->getOptions(); $multidb = $this->getInvokeArg('bootstrap')->getResource('multidb'); $time = time(); Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $multidb->getDb('ts1'))); // 缺少验证接口标识参数 if (empty($query['from'])) { return $this->_redirect('http://www.tudu.com/'); } $from = $query['from']; $className = 'Model_OpenApi_' . ucfirst($query['from']); $classFile = 'Model/OpenApi/' . ucfirst($query['from']) . '.php'; // 缺少配置参数 if (empty($config['openapi'][strtolower($from)])) { return $this->_redirect('http://www.tudu.com/'); } $params = array_merge($config['openapi'][strtolower($from)], $query); header('P3P: CP=”CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR”'); try { require_once $classFile; // 进行登录验证 call_user_func(array($className, 'auth'), $params); // 查找应用组织关联表 $daoAssociate = Tudu_Dao_Manager::getDao('Dao_Md_Org_Associate', Tudu_Dao_Manager::DB_MD); // 获取用户信息 $params = array_merge($config['openapi'][strtolower($from)], array('uid' => $query['uu_id'])); $userInfo = call_user_func(array($className, 'getUserInfo'), $params); $orgId = $daoAssociate->getOrgIdByUid($from, $userInfo['uid']); if (false === $orgId) { $orgId = $this->_getOrgId($from); // 创建组织 require_once 'Model/Org/Org.php'; Model_Org_Org::setResource('config', $config); Model_Org_Org::createOrg($orgId, array('userid' => 'admin', 'password' => md5(Oray_Function::randKeys(16)), 'truename' => $userInfo['truename'], 'orgname' => $userInfo['orgname'])); // 创建关联 $daoAssociate->createAssociate(array('orgid' => $orgId, 'from' => $from, 'uid' => $userInfo['uid'], 'truename' => $userInfo['truename'], 'email' => $userInfo['email'], 'mobile' => $userInfo['mobile'], 'tel' => $userInfo['tel'], 'createtime' => time())); } // 获取用户信息 $adapter = new Tudu_Auth_Adapter_User(Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_MD)); $adapter->setUsername('admin@' . $orgId)->setAuto(true); $result = $adapter->authenticate(); $names = $config['cookies']; if (!$result->isValid()) { $this->_setCookies(array($names['auth'] => false, $names['username'] => false)); return $this->_redirect('http://www.tudu.com/'); } $identity = $result->getIdentity(); // 登录 if (Zend_Session::isStarted()) { session_unset(); Zend_Session::namespaceUnset(self::SESSION_NAMESPACE); Zend_Session::regenerateId(); } $session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, true); $session->auth = array_merge($identity, array('logintime' => $time)); $session->auth['appinvoker'] = $from; // 验证相关的Cookies $this->_setCookies(array($names['username'] => $identity['username'], $names['server'] => $orgId . '.tudu.com'), null); // 其它场合要用到的Cookies,永久。 $this->_setCookies(array($names['track'] => base64_encode('http://www.tudu.com/login')), $time + 86400 * 365); // 同时要登录后台 $adapter = new Tudu_Auth_Adapter_Admin(array('db' => Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_MD))); $adapter->setUsername($identity['username'])->setAuto(true); $result = $adapter->authenticate(); if ($result->isValid()) { $session->admin = array_merge($result->getIdentity(), array('logintime' => $time)); } // 操作失败 } catch (Exception $e) { return $this->_redirect('http://www.tudu.com/'); } return $this->_redirect('http://online-app.tudu.com/frame-inc/'); }
public function processAction() { if (!($form = $this->getCurrentSubForm())) { return $this->_forward('addnewdevotee'); } if (!$this->subFormIsValid($form, $this->getRequest()->getPost())) { $this->view->form = $this->getForm()->prepareSubForm($form); return $this->render('addnewdevotee'); } $form = $this->getNextSubForm(); if ($form) { $this->view->form = $this->getForm()->prepareSubForm($form); return $this->render('addnewdevotee'); } Zend_Debug::dump($this->getSessionNamespace()); $this->view->info = $this->getSessionNamespace(); $form = new Application_Form_Devotees_AddNewDevotee(); $form->setName('addnewdevotee'); $d = new Application_Model_DbTable_Devotee(); $auth = Zend_Auth::getInstance(); $authArray = $auth->getIdentity(); $userid = $authArray['user_id']; $u = new Application_Model_DbTable_Mstuser(); $user = $u->getBasicInfo($userid); /* This section takes data from the session in which data is submitted through subforms of AddNewDevotee form */ $this->info = $this->getSessionNamespace(); $dev_data = array(); foreach ($this->info as $info) { foreach ($info as $form => $data) { foreach ($data as $key => $value) { $dev_data[$key] = $value; // this line gives us devotee data to be inserted in the table. } } } /* below mentioned is a code for renaming the photo */ $fullFilePath = $form->uplphoto->getFileName(); $fullfilename = pathinfo($fullFilePath); $dev_photo_name = $this->getlastdid() . '_' . rand(0, 100) . '.' . $fullfilename['extension']; /* Below is the data to be inserted in devotee table */ //-------------------Date of Birth-------------------------------------- //if(array_key_exists('birth_day',$dev_data)&& // array_key_exists('birth_month',$dev_data)&& // array_key_exists('birth_year',$dev_data)){ $birthdatearray = array('year' => $dev_data['birth_year'], 'month' => $dev_data['birth_month'], 'day' => $dev_data['birth_day']); //} $birthdate = new Zend_Date($birthdatearray); //-------------------Date of Begining of chanting------------------------ //if(array_key_exists('bgn_chan_from_day',$dev_data)&& // array_key_exists('bgn_chan_from_month',$dev_data)&& // array_key_exists('bgn_chan_from_year',$dev_data)){ $bgn_chan_from_datearray = array('year' => $dev_data['bgn_chan_from_year'], 'month' => $dev_data['bgn_chan_from_month'], 'day' => $dev_data['bgn_chan_from_year']); //} $bgn_chan_from_date = new Zend_Date($bgn_chan_from_datearray); //-------------------Date of Begining of 16 rounds chanting--------------- //if(array_key_exists('chan_16_rounds_year',$dev_data)&& // array_key_exists('chan_16_rounds_month',$dev_data)&& // array_key_exists('chan_16_rounds_year',$dev_data)){ $chan_16_rounds_datearray = array('year' => $dev_data['chan_16_rounds_year'], 'month' => $dev_data['chan_16_rounds_month'], 'day' => $dev_data['chan_16_rounds_day']); //} $chan_16_rounds_date = new Zend_Date($chan_16_rounds_datearray); //-------------------Date of harinam initiation--------------------------- //if(array_key_exists('harinam_initiatn_day',$dev_data)&& // array_key_exists('harinam_initiatn_month',$dev_data)&& // array_key_exists('harinam_initiatn_year',$dev_data)){ $harinam_initiatn_datearray = array('year' => $dev_data['harinam_initiatn_year'], 'month' => $dev_data['harinam_initiatn_month'], 'day' => $dev_data['harinam_initiatn_day']); //} $harinam_initiatn_date = new Zend_Date($harinam_initiatn_datearray); //-------------------Date of brahman initiation------------------------ //if(array_key_exists('date_of_brahman_initiation',$dev_data)&& // array_key_exists('brahman_initiation_month',$dev_data)&& // array_key_exists('brahman_initiation_year',$dev_data)){ $brahman_initiation_datearray = array('year' => $dev_data['brahman_initiation_year'], 'month' => $dev_data['brahman_initiation_month'], 'day' => $dev_data['date_of_brahman_initiation']); //} $brahman_initiation_date = new Zend_Date($brahman_initiation_datearray); //-------------------Date of sanyas_initiation------------------------ //if(array_key_exists('sanyas_initiation_day',$dev_data)&& // array_key_exists('sanyas_initiation_month',$dev_data)&& // array_key_exists('sanyas_initiation_year',$dev_data)){ $sanyas_initiation_datearray = array('year' => $dev_data['sanyas_initiation_year'], 'month' => $dev_data['sanyas_initiation_month'], 'day' => $dev_data['sanyas_initiation_day']); //} $sanyas_initiation_date = new Zend_Date($sanyas_initiation_datearray); $devotee_data = array('pics' => $dev_photo_name, 'first_name' => $dev_data['first_name'], 'middle_name' => $dev_data['middle_name'], 'last_name' => $dev_data['last_name'], 'do_birth' => $birthdate->toString('yyyyMMddHHmmss'), 'gender' => $dev_data['gender'], 'country_id' => $dev_data['cc'], 'center_id' => $dev_data['center'], 'counselor_id' => $dev_data['counselor'], 'mobile' => $dev_data['mobile'], 'email' => $dev_data['email'], 'pres_phone' => $dev_data['phone_number'], 'devotee_status' => $dev_data['active_status'], 'asram_status_id' => $dev_data['marital_status'], 'mother_tongue_id' => $dev_data['mother_tongue'], 'counselee_status' => $dev_data['counselee_status'], 'blood_group' => $dev_data['bld_grp'], 'religion_id' => $dev_data['previous_religion'], 'native_place' => $dev_data['native_place'], 'native_state_id' => $dev_data['native_state'], 'pres_add1' => $dev_data['present_addline1'], 'pres_add2' => $dev_data['present_addline2'], 'pres_locality_id' => $dev_data['present_locality'], 'pres_pin' => $dev_data['present_zip_code'], 'pres_city_id' => $dev_data['present_city'], 'pres_state_id' => $dev_data['present_state'], 'pres_country_id' => $dev_data['present_country'], 'perm_add1' => $dev_data['permenant_addline1'], 'perm_add2' => $dev_data['permenant_addline2'], 'perm_locality_id' => $dev_data['permenant_locality'], 'perm_pin' => $dev_data['permenant_zip_code'], 'perm_city_id' => $dev_data['permenant_city'], 'perm_state_id' => $dev_data['permenant_state'], 'perm_country_id' => $dev_data['permenant_country'], 'perm_phone' => $dev_data['phone_number'], 'father_name' => $dev_data['father_name'], 'mother_name' => $dev_data['mother_name'], 'isgurukuli' => $dev_data['gurukuli'], 'edu_cat_id' => $dev_data['highest_education'], 'education_qualification' => $dev_data['education_description'], 'occupation_id' => $dev_data['occupation'], 'designation' => $dev_data['designation'], 'merits' => $dev_data['merits_awards'], 'skill_set' => $dev_data['skill_sets'], 'off_name' => $dev_data['office_name'], 'off_add1' => $dev_data['office_address_line1'], 'off_add2' => $dev_data['office_address_line2'], 'off_locality_id' => $dev_data['office_locality'], 'off_city_id' => $dev_data['office_city'], 'off_state_id' => $dev_data['office_state'], 'off_country_id' => $dev_data['office_country'], 'off_pin' => $dev_data['office_zip_code'], 'off_phone' => $dev_data['office_phone'], 'chanting_started' => $bgn_chan_from_date->toString('yyyyMMddHHmmss'), 'chk_chant_start' => $dev_data['bgn_chan_from_na'], 'no_of_rounds' => $dev_data['no_rou_pres_chanting'], 'chanting_16_started' => $chan_16_rounds_date->toString('yyyyMMddHHmmss'), 'intro_by' => $dev_data['intro_by'], 'intro_year' => $dev_data['year_introduction'], 'intro_center' => $dev_data['intro_center'], 'chk_date_harinam' => $dev_data['harinam_initiatn_na'], 'do_harinaminit' => $harinam_initiatn_date->toString('yyyyMMddHHmmss'), 'chk_date_brahmin' => $dev_data['brahman_initiated_na'], 'do_brahmininit' => $brahman_initiation_date->toString('yyyyMMddHHmmss'), 'ini_guru_id' => $dev_data['sanyas_spiritual_master'], 'chk_date_sanyas' => $dev_data['sanyas_initiation_day'], 'do_sanyasinit' => $sanyas_initiation_date->toString('yyyyMMddHHmmss'), 'sanyas_name' => $dev_data['sanyas_name'], 'sanyas_title' => $dev_data['sanyas_title'], 'sanyas_guru_id' => $dev_data['sanyas_spiritual_master'], 'spiritualname_sanyas_id' => $dev_data['sanyas_name'], 'remarks' => $dev_data['remarks'], 'user_id' => $user['id'], 'isactive' => $user['is_active'], 'entered_date' => Zend_Date::now()->toString('yyyyMMddHHmmss'), 'dolm' => $user['dolm'], 'modibyuid' => $user['modi_by_uid'], 'entered_by_uid' => $user['entered_by_uid'], 'do_verify' => Zend_Date::now()->toString('yyyyMMddHHmmss')); $did = $d->insert($devotee_data); $this->view->lastrecordinserted = $did; $this->render('verification'); //Clear the session data Zend_Session::namespaceUnset($this->_namespace); }
function loginAction() { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); if ($this->_request->isPost()) { //1.Goi ket noi voi Zend Db $db = Zend_Registry::get('connectDB'); //$db = Zend_Db::factory($dbOption['adapter'],$dbOption['params']); //2. Khoi tao Zend Autho $auth = Zend_Auth::getInstance(); //3. Khai bao bang va 2 cot se su dung so sanh trong qua tronh login $authAdapter = new Zend_Auth_Adapter_DbTable($db); $authAdapter->setTableName('users')->setIdentityColumn('username')->setCredentialColumn('password'); //4. Lay gia tri duoc gui qua tu FORM $uname = $purifier->purify($this->_request->getParam('username')); $paswd = $purifier->purify($this->_request->getParam('password')); // $uname = $this->_request->getParam('username'); // $paswd = $this->_request->getParam('password'); //5. Dua vao so sanh voi du lieu khai bao o muc 3 $authAdapter->setIdentity($uname); $authAdapter->setCredential(md5($paswd)); //6. Kiem tra trang thai cua user neu status = 1 moi duoc login $select = $authAdapter->getDbSelect(); // $select->where('status = 1'); //7. Lay ket qua truy van $result = $auth->authenticate($authAdapter); $flag = false; if ($result->isValid()) { //8. Lay nhung du lieu can thiet trong bang users neu login thanh cong $data = $authAdapter->getResultRowObject(null, array('password')); //9. Luu nhung du lieu cua member vao session $auth->getStorage()->write($data); $flag = true; } $session = new Zend_Session_Namespace('identity'); if ($flag == true) { // $this->_redirect('/admin/index'); $session->username = $uname; // echo "thanh cong"; } else { Zend_Session::namespaceUnset('identity'); // echo "khong thanh cong"; } } //$this->_helper->viewRenderer->setNoRender(FALSE); }
public static function destroy() { $session = static::has(); if ($session) { Zend_Session::namespaceUnset('USER'); } }