beer Posted June 7, 2010 Share Posted June 7, 2010 I have a question: If you do this: $first_name = "bart"; $_SESSION["first_name"] = $first_name; echo $_SESSION["first_name"]; You'll get bart, CORRECT? Now try this: $_SESSION["last_name"] = "simpson"; echo $last_name; What do you get? Yes, that's right: simpson Is this the normal behavior of SESSION? That is, just put a $ plus whatever's inside $_SESSION[""], and you get a variable that is EQUIVALENT to your SESSION? Try it for yourself! Please help me clarify this.... Thanks. Link to comment https://forums.phpfreaks.com/topic/204054-is-_sessionwhatever-equal-to-whatever-mine-is-is-this-normal/ Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 Are you sure $last_name is not defined somewhere else in your script, or possibly globally? Link to comment https://forums.phpfreaks.com/topic/204054-is-_sessionwhatever-equal-to-whatever-mine-is-is-this-normal/#findComment-1068794 Share on other sites More sharing options...
trq Posted June 7, 2010 Share Posted June 7, 2010 Turn off register_globals in your php.ini. they have been deprecated for some 8+ years and pose a security risk. Link to comment https://forums.phpfreaks.com/topic/204054-is-_sessionwhatever-equal-to-whatever-mine-is-is-this-normal/#findComment-1068795 Share on other sites More sharing options...
beer Posted June 7, 2010 Author Share Posted June 7, 2010 Hi Muffins, thanks for the help. Nope, I don't have a variable SET Globally, in fact, I have put something $_SESSION["this_is_weird"] and echo $this_is_weird... then I still get the same value of the session! @thorpe - That is it! Thank you so much! I turned it OFF and it's gone. Link to comment https://forums.phpfreaks.com/topic/204054-is-_sessionwhatever-equal-to-whatever-mine-is-is-this-normal/#findComment-1068796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.