[eluser]CodeOfficer[/eluser]
Hey gang,
I searched the forums for an hour and was unable to find any discussion on this topic. I hope someone can point me in the right direction. 2 questions actually ... second one is tiny
Question #1
I'm looking for some ideas on how I'd let a user log into my site and resume a session he might have started
on another machine earlier that day, week, year, etc ...
Prior knowledge:
My sessions are set to be stored in the DB
Sessions get autoloaded for the entire site in my autoload.php file
Example:
Joe visits my website from his Dell while at work. (no worries, its work safe!) He doesn't know it yet, but my site knows how to store his session data in a database ( sess_match_ip & sess_match_useragent == false). He successfully logs into his account and a cookie is stored on his machine with only his session_id. He surfs for a bit and accumulates some data. (maybe hes shopping and filling a cart for later, or maybe hes filling out a long long form of information and wants to save its progress and come back to it.) Five o'clock ..... Joe goes home.
*not sure exactly which data I'd want in the session table at this point outside of the normal session_id, ip_address, user_agent, last_activity, session_data [user_id] but I'll continue ...*
About 8:00, Joe fires up his MacBook and visits my site. ...
... Now at this point, because sessions are autoloading, he has a generic session_id in the db and a matching cookie. what I am uncertain about is how to get Joe back to his session he had a few hours ago on another machine. I'm tripping over the logic involved in testing his imminent login against the session table ...
specifically, in the situation that his prior session data might have important data in it.
Question #2
I assume its bad practice to store too much data directly into the sessions table. But a thought arrises, is it possible to query that data on the content of its session_data in any way? And unrelated to that question, when do old session records get cleaned out? I know cookies expire based on an expiration date, but what about older db records?
Thanks for your time, hope was clear on my confusion ... wait, is that even possible?