problem in login using sessions
Moderator: General Moderators
-
dumbledore
- Forum Newbie
- Posts: 2
- Joined: Thu Oct 08, 2009 7:08 am
problem in login using sessions
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
You should completely destroy the session on logout.
-
dumbledore
- Forum Newbie
- Posts: 2
- Joined: Thu Oct 08, 2009 7:08 am
Re: problem in login using sessions
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
See the Example #1:
http://www.php.net/session_destroy
http://www.php.net/session_destroy
Re: problem in login using sessions
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.
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.