Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 22 August 2006 - 09:58 AM

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
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#2 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 22 August 2006 - 10:37 AM

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
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users