I have a very simple page, in which I check to see if there is a $_SESSION[‘username’] set, to see if the user is logged in. If not, I issue an error, which I email to myself.
When I display the page for the first time, it appears correctly (I am logged in) BUT I receive an email stating that session info isn’t set. If I put an “echo” statement or something in the “else” of that check, it never appears: page is always displayed correctly!
So it’s as if the adsense code is causing a “render” of the page without session variables set. Then the session variables are set, and the page is displayed correctly!?
Now the “first time” is a hint. Subsequent visits to that page don’t cause errors. If I clear cookies and browser data (I didn’t check to see if it’s cookies specifically, I assume it is) then the error happens again.
Here’s the code on the page causing the error:
Any ideas?? How to solve this? Obviously I can live without the email messages, by just removing them, but I would like to turn that error checking on, and reporting. PLUS, I think it’s a sign of a more serious issue.
ps: I set that session variable very simply:
$_SESSION['username'] = $uRow['username']; header ("Location: /home/");