Original Post
I'm becoming very livid at this point with frustration and am now cooling down and asking for help. It seems as if session variables on a website of mine has ceased to function correctly. The PHP file has not been touched, my code is, at least it seems to me, correct, and yet, I set a session variable on one page and poof, it's gone when I go to the next page. ARGG! In this particular case, it's a debug. The concept is very, very simple. In the url, I add &debug=1 or &debug=2, depending on what debug mode I want. From that point on, a session variable, you guessed it, 'debug', contains the value that I have set and so on every page I load, I get my debug info. I have this setup and actively working on one site, and yet, on this site, where some changes have been made but do not affect this variable, it is not working. If I specify &debug=0, the debugger is turned off, hooray! Simple right? Well, it be broke (yes I meant "it be broke"). I've searched all files on the site to see if the session variable is set or altered anywhere, but it is only set at one point. My site has an MVC-ish setup and so I have several files that are included that comprise of the overall site and includes, blah blah. So here's a rundown of the process: A module is called via ?m=[module] through index.php. The only include here is master.inc, which contains a list of includes as well as defines the user permissions used throughout the site: session_start(); include db.inc - Database commands only. include rpc.inc - Used for custom AJAX functionality include functions.inc - Common functions include calednar.inc - Calendar class include duration.inc - Class used to convert seconds to an interval include user.inc - User class include role.inc - Role class At this point, I check $_COOKIE for the user_id, if set, set $_SESSION['user_id'] with the cookie value. This method is temporary. If $_SESSION['user_id'] is set, I reset the cookie using setcookie() Now I gather both all and specific user permissions and begin setting my constants (constants are uppercase permission names set with a 1 (allowed) or 0 (denied)) include settings.inc - Various constants and global variables are set here. The very last variable being set is the debug variable. In settings.inc, I have tried debugging this problem by printing $_SESSION and seeing the values set. A print before and after this portion should tell me what's going on. So if on one page I set debug=2, I get 0 and 2. Refreshing the page gives me 2 and 2 (as it should). Opening a different page in another tab or simply going to another page will give me 0 and 0 since debug=2 isn't at the top (but the point of this is to NOT set that everywhere I go). Now that I've rambled, does this problem make any sense? Any suggestions? Edit: Ok, I assumed a result when in fact I was wrong. Going to another page, at least in this case, does not give me a 0 and 0 before and after value (it gives me the initial debug value, in this case, 2 and 2). I kill the script after printing this out, so something is going haywire after this part... joygasm... Edit 2: More odd behaviour. What seemed like was working is now going nutso again. Edit 3: It's just getting better. More testing and debugging has shown that on one page, when I've specified &debug=1 and the on a 2nd tab, when I've got nothing specified, I refresh the first, I see 1 and 1, I refresh the second, I see 2 and 2. WTHECK! [Edited by - Mathachew on September 15, 2006 12:02:06 AM]