Session or Cookie?
Posted: Mon Oct 20, 2008 9:57 pm
Hello all
I have a question, Im working on a website that allows users to login and see other logged users.
When a user logs in his/her status is updated to 'islogged=true' and when he/she logs out its set to 'islogged=false' (islogged being a row in mysql database). This is working perfectly but now I want a users 'islogged' status to be reset to 'false' if he or she is afk for too long. Im currently using session to keep user logged in through out the site but I don“t understand how to set the expiration time. I tried the function session_cache_expire() it return the value 180 so I thought it meant that the session would be destroyed in 3 minutes, so I closed the browser for 3 minutes and opened it again but I was still logged in i.e the session was still there. Should I be using cookies instead or both?
I have a question, Im working on a website that allows users to login and see other logged users.
When a user logs in his/her status is updated to 'islogged=true' and when he/she logs out its set to 'islogged=false' (islogged being a row in mysql database). This is working perfectly but now I want a users 'islogged' status to be reset to 'false' if he or she is afk for too long. Im currently using session to keep user logged in through out the site but I don“t understand how to set the expiration time. I tried the function session_cache_expire() it return the value 180 so I thought it meant that the session would be destroyed in 3 minutes, so I closed the browser for 3 minutes and opened it again but I was still logged in i.e the session was still there. Should I be using cookies instead or both?