session set for some Actions in Zend framework

Posted by user202127 on Stack Overflow See other posts from Stack Overflow or by user202127
Published on 2012-11-28T11:02:54Z Indexed on 2012/11/28 11:03 UTC
Read the original article Hit count: 158

Filed under:
|

I'm working on a website , in CV part users have some articles that only logged in users can download them.I want to make changes to the log in Action or preDispatch() to set session for guess users to download the articles,

can some one tell me how it can be or give me some reference links.

here is my preDispatch():

public function preDispatch()
{
    $userInfo=$this->_auth->getStorage()->read();
    $identity= $this->_auth->getIdentity();
    if(!$this->_auth->hasIdentity())
    {

        return $this->_helper->redirector('login','login');


    }
    if(!isset($userInfo["member_id"]) || strlen($userInfo["member_id"])==0)
    {
        return $this->_helper->redirector('forbidden','login');
    }
    $this->_accessType=2;

}

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-auth