Guest Stefán Örvarr Sigmundsson Posted May 31, 2009 Share Posted May 31, 2009 I'm having a lot of trouble with sessions.1. I seem to be unable to destroy the sessions I create.2. When I check to see if my 'lang' session has been set (with the isset function) it tells me the session has not been set, but still I am able to get the contents of it by writing echo $_SESSION['lang'];3. Why doesn't this work for Firefox: $_SERVER["HTTP_ACCEPT_LANGUAGE"]?Should I abandon PHP altogether? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 1, 2009 Share Posted June 1, 2009 1. I seem to be unable to destroy the sessions I create.You could do this:$_SESSION = array();but that's going to remove all session information, not just yours (which only applies if there are several things using sessions on the same server). When I log someone out or otherwise get rid of the session I just unset the specific things I set.unset($_SESSION['userid']);2. When I check to see if my 'lang' session has been set (with the isset function) it tells me the session has not been set, but still I am able to get the contents of it by writing echo $_SESSION['lang'];There's something wrong with the code, it won't tell you a variable is not set if it has a value. Are you using isset before session_start?3. Why doesn't this work for Firefox: $_SERVER["HTTP_ACCEPT_LANGUAGE"]?Not all browsers send the same set of HTTP headers, your copy of Firefox might not be sending the accept-language header. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.