Page 1 of 1

problem in login using sessions

Posted: Thu Oct 08, 2009 7:17 am
by dumbledore
I am creating a user login using php where in i have to enforce user to change his/her passwd if its their first login.I have used a first_login_flag in the mysql database for this purpose.when user logs in, first_login_flag is set to 'N'.now the problem is that it works fine for the first user. but when i try to log in as the second user, it takes the old session values. and takes the first_login_flag as 'N'. this is wrong as this is the first login for this second user.please help me using the sessions. thanks.

Re: problem in login using sessions

Posted: Thu Oct 08, 2009 7:29 am
by jackpf
You should completely destroy the session on logout.

Re: problem in login using sessions

Posted: Thu Oct 08, 2009 8:00 am
by dumbledore
Thanks. Actually i am really new in php and dont know anything about sessions. could you help me out with the code.

Re: problem in login using sessions

Posted: Thu Oct 08, 2009 8:06 am
by Eric!

Re: problem in login using sessions

Posted: Thu Oct 08, 2009 10:31 am
by desperado
Think of a session as "This browser window is open right now, and I'm browsing on the server."

If you log out as one user and log-in as another user (same browser, same window) the server will consider it to be the same session.

Either close your browser window, or quit the browser to close your session.

if you destroy the session on log out within your php code, then you avoid this problem altogether.