FilChi Weblog

my issue with cakephp sessions

Posted on: June 12, 2008


Two days before this is posted on this blog, I encountered an issue with the sessions in cakephp on my personal cakephp project. I felt frustrated when I realized that the sessions do not load when logging in.

The part of the source code where I think it is the problem is in here in my users_controller.php:

$this->Session->write(“Users.id”,$activeuser[‘users’][‘id’]);
$this->Session->write(“Users.username”,$activeuser[‘users’][‘username’]);
$this->redirect(“/”,null,true);

So, I asked around on twitter using Twhirl about this sessions issue. Petixe replied and told me that I should save the sessions in database instead. So, I thought, yeah well, okay. But still, nothing changed.

chartjes suggested that I should change Security.level to ‘medium’. I already did this before going home from work yesterday. But still, nothing happened. And yes ,dhofstet, it is still the same result even if this is set to ‘low’.

To prove to my dear readers that I know what I am doing with the sessions, here’s a screenshot of the sessions successfully loaded on my local copy.

If you want to check the site done online, please visit http://phpcurious.890m.com/learntheweb .

Session Issues

Advertisements

3 Responses to "my issue with cakephp sessions"

$this->Session->write(”Users.id”,$activeuser[‘users’][‘id’]);
$this->Session->write(”Users.username”,$activeuser[‘users’][‘username’]);
$this->redirect(”/”,null,true);

can be written as :

$this->Session->write(”Users”,$activeuser);
$this->redirect(”/”,null,true);

or maybe you just want id, username to be save in sessions?

Hey ajmacaro,

Thanks for visiting my site. sorry for the late reply.
I just implemented AuthComponent + Acl for the login and registration, so the login won’t be just using Sessions anymore.

thanks it working

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: