I have a script which when loaded grabs the "MemberID" from the $_SESSION, and then uses that to run an UPDATE query which puts a timestamp in that Member's "Last_activity" field.
This script is Included in most of my other web pages, so as a person navigates through my website, I give them credit for being active, and update their Member record.
On to my problem...
I have been dinking around with my code and Sessions this week, and have everything working, but all of a sudden noticed that when I Log Out, and then Log In again, instead of being taken to the Home Page, I get a user-defined error about "Member Status could not be updated".
The only way this could happen - I have this traced down to a specific Error Code - is if my UPDATE query failed due to no MemberID.
Hello! I just logged in when I get this error?! :rolleyes:
And I checked my Session Cookie in MAMP, and it shows a MemberID and LoggedIn = TRUE.
It seems like my Included file is firing before my base script (e.g. "index.php") can load the MemberID from the $_SESSION variable?!
Again, I know that I have a valid MemberID and am Logged In on my Home Page, because I can see things like "Welcome Debbie!"
If I move my Include line from the top of the script to the very last line, then the issue goes away?! (This seems to further verify this is a *timing* issue.)
I guess I would like to get a more scientific answer for why this started happening all of a sudden.
It seems really half-*ssed to have to put my Include at the end of my script for it to work, and I fear that maybe there is some larger issue I am not seeing.
Any idea what is going on??