blueman378 Posted March 11, 2008 Share Posted March 11, 2008 hi guys i was playing today and noticed how easily my sessions are being overwrote eg using this code: <? session_start(); $_SESSION['level'] = 3; echo $_SESSION['level']; $level = 1; echo $_SESSION['level']; ?> it outputs: 31 are sessions meant to be overwrote this easily? or am i doing something wrong with my coding, i can use nonuniform names eg gtxlevel but i would prefer not to and be able to define variables also and undeerstad both Link to comment https://forums.phpfreaks.com/topic/95561-sessions-being-overwrote-too-easily/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 11, 2008 Share Posted March 11, 2008 That is caused by register globals. Either turn register globals off or use unique names for program/post/get/cookie/session variables. Link to comment https://forums.phpfreaks.com/topic/95561-sessions-being-overwrote-too-easily/#findComment-489221 Share on other sites More sharing options...
Northern Flame Posted March 11, 2008 Share Posted March 11, 2008 or its probably because u have nothing separating your data, <? session_start(); $_SESSION['level'] = 3; echo $_SESSION['level']; echo "<br />"; $level = 1; echo "<br />"; echo $_SESSION['level']; ?> Link to comment https://forums.phpfreaks.com/topic/95561-sessions-being-overwrote-too-easily/#findComment-489224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.