Forum Moderators: coopster
I am building a members section for my site and I was curious what the best way to go about remember users would be. The site I'm working on is mainly an information site which will have the ability for people to login and view reviews on products and also allow manufacturers to login and upload information about their products.
I was curious how I should remember a user is on my site. Currently, I have a $_SESSION[''] variable that remembers them but when they open a new browser it forgets them. Also this posses problems if they are still viewing my site but want to have 2 browsers open while on my site.
Is this the best method? Also considering they login - they will have to relogin everytime they come back to my site. This makes me wonder if I should use cookies. I have never used them before. Would they be the best solution? Are they secure?
Any information would be great :)
Thanks!
Wes
ini_set('session.cookie_lifetime',(3600*24*365)); // makes cookie good for a year
One problem with that is the server's temp directory might get clogged with saved sessions. If you have a high traffic site, this could cause problems. You can either use cookies, or make the cookie lifetime something like 30 days.
See [php.net...] for more information.
Hope this helps!
One problem with that is the server's temp directory might get clogged with saved sessions
If this is likely to become a problem - you could always set a custom session handler and write everything into a database :)
http://uk.php.net/manual/en/function.session-set-save-handler.php [uk.php.net]
Cheers,
JP