On Sat, Apr 11, 2009 at 9:54 AM, Dave Maharaj :: WidePixels.com
<[email protected]> wrote:
>
> Reading thru the cookbook on cookies and sessions but I cannot get it to
> work. I have the toolbar installed so I can see the data easier. I have this
> in my app_controller:
>
> var $components = array('Auth', 'Acl', 'RequestHandler', 'Cookie',
> 'DebugKit.Toolbar');
> var $helpers = array('Html', 'Form', 'Javascript', 'Mailto', 'Time',
> 'Ajax');
> var $cookieName = 'mysite';
> var $cookieKey = '^SIp35555';
> var $cookieTime = 7200;
function beforeFilter()
{
$this->Cookie->name = 'mysite';
$this->Cookie->key = '^SIp35555';
$this->Cookie->time = 7200;
}
>
> in my User login ()
> i have this just to test it out
>
> // Grab some data from the User table and set them to the cookie array
> $cookie = array();
> $cookie['user_id'] = $this->Auth->user('id');
> $cookie['firstname'] = $this->Auth->user('firstname');
> $cookie['slug'] = $this->Auth->user('slug');
>
> $this->Session->write('Auth.User', $cookie);
>
$this->Cookie->write('user_id', $this->Auth->user('id'));
$this->Cookie->write('firstname', $this->Auth->user('firstname'));
$this->Cookie->write('slug', $this->Auth->user('slug'));
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---