本文整理汇总了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;
}