Jump to content

Archived

This topic is now archived and is closed to further replies.

willpower

Solved (but dont ask) Session Help - Should be easy

Recommended Posts

Hi

Imagine that the user logs in with username and password and this is checked for validity in 'check_user.php'.  Once vaildated this file stores the data in $_SESSION['user']=$username and redirects the user back to the referring page.

If the session in set/registered the referring page now displays the users shopping cart. and log on message " You are logged in as $SESSION['user'];

With me so far.

This all works...wey hey.

But when I refresh this page or navigate to another....gues what happens.

NO they arent asked to log in again....but the displayed username (the session var) changes from the username to "0"

WHY.....

I can post code but as there is a lot I wondered if anyone has had a similar issue first or can give me some poinetsr to check.

session_start() is included in all files.
why would it change on a page refresh?

thanks

Will

When validated an include 'shopping

Share this post


Link to post
Share on other sites
Well I don't know exactly what happened....but

I fixed it.  I renamed all the session vars and that cleared up my issue.  Apparently something to do with session value leakage in var names.

dont ask

Will

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.