• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

PHP $_SESSION Conundrum

rabbitt

n00b
Joined
Feb 18, 2005
Messages
33
I'm building a site and using sessions, I've done this a million times before and it worked fine.

What's happening is I'm using a single page to handle 3 submits, posting back to itself. On the first submit, a session is registered (session_register['user']; $_SESSION['user']=$user;).
I'm checking the 'user' variable in two places: at the beginning of the page and right after the code that sets the session. The beginning displays nothing, but the second shows the session variable correctly.

I've narrowed it down to two things:
1. If a page registers a session variable and POSTS back to itself, is the session destroyed (highly doubt this but just want my sanity confirmed)?
2. If there is html & header information on the page previous to the session_start(), does it mess up the sessions?
 
also, session_register is effectively deprecated due to changes in global variable handling. you just need to use $_SESSION['thing']=value; and you're fine.
 
Back
Top