We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,970 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Using php $_session, help for $_cookie

Dear Friends,

I'm Currently using php session ( $_SESSION ), I want to use $_COOKIE Because when a user didn't click the logout button and he closed the website. still he is showing Online because i write the code at the logout page.

So If we use $_COOKIE it is update the database ? Please help me

3
Contributors
2
Replies
14 Hours
Discussion Span
1 Year Ago
Last Updated
4
Views
Question
Answered
rayidi
Junior Poster in Training
83 posts since May 2011
Reputation Points: 13
Solved Threads: 2
Skill Endorsements: 0

I think that you need to consider / explain how you want to accomplish this in a bit more detail. It seems that you need to keep track of who is active and the time of their last activity. If they have closed the web page for your site, then you won't have anything running on the server for that session (that can access session or cookie data). You probably need some sort of timed task that will periodically check the time of last activity for whoever you believe to be online and mark them as offline if the last activity was older than some pre-determined period (e.g. 30 minutes).

chrishea
Nearly a Posting Virtuoso
1,484 posts since Sep 2008
Reputation Points: 223
Solved Threads: 243
Skill Endorsements: 5

You can check for a session and a valid in-time value.
The mysql db stores the session id and the last activity (e.g. page impression)
You can stop somebody carrying on with a session if there is no activity within say 20 minutes.

diafol
Keep Smiling
Moderator
10,647 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,510
Skill Endorsements: 57
Question Answered as of 11 Months Ago by diafol and chrishea

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0888 seconds using 2.68MB