I'm having a little bit of a problem with using sessions. I have created a website using php and mysql. This site is interactive with about 700 members. I am using sessions instead of cookies. At the top of each page I have start_session(); and where necessary I register the sessions. My problem is this. It seems that the session variable is being lost for no reason. I don't know much about sessions, but I do believe that the session variables are being stored on a remote server that I am using(someone else is hosting my site). It seems that the session variables are being lost regardless if the user is idle or not on the site. How can I prevent this? Will storing the session variable in a table in my database help? Will using a cookie in conjunction with the session help? I appreciate any advice anyone may have.
thanks.
Sessions write a session_id cookie to the client machine (look in your browser-it should be called PHPSESSID). That cookie will expire after 20 minutes (or whatever default time).
I recently had a problem dropping sessions when moving from www.mysite.com to mysite.com. Note that PHP will start a new session_id for each domain.
Um... Isn't it session_start();?
Also, PHP figures out how to pass the session id. If the user won't accept a cookie it will pass the session id through the $_GET array.
Thank You!!