本文整理匯總了PHP中BaseUser::isLogged方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseUser::isLogged方法的具體用法?PHP BaseUser::isLogged怎麽用?PHP BaseUser::isLogged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseUser
的用法示例。
在下文中一共展示了BaseUser::isLogged方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: indexAction
/**
* index action, check if the user has connected,
* @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
* @param <empty>
* @return <empty>
*/
public function indexAction()
{
if (BaseUser::isLogged()) {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
} else {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
}
}
示例2: loginAction
/**
* login action, Allow the User to connect
* @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
* @param <empty>
* @return <empty>
*/
public function loginAction()
{
if (BaseUser::isLogged()) {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
}
$this->title = 'Login';
$form = new LoginForm();
if ($this->getRequest()->isPost()) {
if ($registration = $this->getRequest()->getParam('inscription', false)) {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'add'), 'default', true));
}
if ($form->isValid($this->getRequest()->getPost())) {
if ($this->_userModel->login($form->getValue('username'), $form->getValue('password'))) {
$member = App_Utilities::setMember_Registry();
if ($member->validate == 1) {
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
} else {
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::destroy();
$this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
}
}
} else {
$this->_authentification->addFailedLogin();
}
$this->view->error = TRUE;
}
$this->view->form = $form;
}