jkewlo Posted March 24, 2008 Share Posted March 24, 2008 i dont understand sessions and how it is supposed to store the username etc... session_start(); session['username']; session['leve']; on the profile page i have session_start(); all in <? ?> tags then i have a if statement if($_SESSION['level'] = 3){ echo "<a href=admin.php>Admin</a>"; } but it displays that no matter what user i sign in with i cleared my cookies closed firefox refreshed the browser im going nuts. sad thing this isnt even my project and if it was i woudltn be using MS Access etiher Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/ Share on other sites More sharing options...
darkfreaks Posted March 24, 2008 Share Posted March 24, 2008 <?php if($_SESSION['level'] == "3"){ echo "<a href=admin.php>Admin[/url]"; } ?> Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499939 Share on other sites More sharing options...
jkewlo Posted March 24, 2008 Author Share Posted March 24, 2008 it dosnt display the link for users that have Level 3 access Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499940 Share on other sites More sharing options...
cooldude832 Posted March 24, 2008 Share Posted March 24, 2008 try <?php print_r($_SESSION); ?> and see what it says in there Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499942 Share on other sites More sharing options...
darkfreaks Posted March 24, 2008 Share Posted March 24, 2008 echo out the sesion variable what is being displayed? ??? Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499943 Share on other sites More sharing options...
jkewlo Posted March 24, 2008 Author Share Posted March 24, 2008 Array ( [Auth] => tester1 ) Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499945 Share on other sites More sharing options...
darkfreaks Posted March 24, 2008 Share Posted March 24, 2008 <?php $level= isset($_SESSION['level']); if($level=="3") { echo"<a href=admin.php>Admin[/url]"; } ?> Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499951 Share on other sites More sharing options...
cooldude832 Posted March 24, 2008 Share Posted March 24, 2008 that don't' work $level = isset($_SESSION['level']); will return a 0 or1 on success of isset function the problem is you aren't setting the variable $_SESSION['level']; so maybe you should set it first and then try and use it. Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499954 Share on other sites More sharing options...
darkfreaks Posted March 24, 2008 Share Posted March 24, 2008 ..i was right the first time <?php if($_SESSION['level'] == "3"){ echo "<a href=admin.php>Admin[/url]"; } elseif($_SESSION['level'] == "2"){ //dostuff } elseif($_SESSION['level'] == "1"){ //dostuff }?> ?> Link to comment https://forums.phpfreaks.com/topic/97702-going-to-flip-out/#findComment-499961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.