Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # my session is not working properly.
- # The routine(s) show no errors, but doing print_r($session) shows no object for my session either.
- ## in my application.ini [text]
- ;session configuration
- sessions.name = Logins
- sessions.use_only_cookies = on
- sessions.cookie_lifetime = 36000 ;set to the number of seconds the session should stay valid for
- sessions.gc_maxlifetime = 36000 ;set to the number of seconds the session should stay valid for
- ## in my bootstrap class [php]
- protected function _initConfigs()
- {
- $this->bootstrap('db');
- Zend_Registry::set("db", $this->getResource('db'));
- $config = new Zend_Config_Ini(APPLICATION_PATH. '/configs/application.ini', APPLICATION_ENV);
- Zend_Registry::set("config", $config);
- Zend_Session::setOptions($config->sessions->toArray());
- $sesion = new Zend_Session_Namespace('Logins');
- Zend_Registry::set("session", $session);
- }
- ## in one of my login controller [php]
- //user credentials are good
- $session = Zend_Registry::get("session");
- $session->userid = $user;
- ## in my view [php]
- $session = Zend_Registry::get("session");
- if (!empty($session->userid))
- echo "You are logged in as ". $session->userid;
- else
- echo "You are not logged in";
Add Comment
Please, Sign In to add comment