jmr3460 Posted December 14, 2009 Share Posted December 14, 2009 I am trying to use $_SESSION cookies to verify admin privileges . I don't understand why this is not working: /*everything above here is working*/ $session = mysql_fetch_array($session_query); $type = $session['admin_type']; $name = $session['admin_name']; $level = $session['admin_level']; $_SESSION['type'] = $type; $_SESSION['name'] = $name; $_SESSION['level'] = $level; /*This is returning false*/ if(isset($_SESSION['type'])) { if($_SESSION['type'] == 'regional') { header('Location: all_admin.php'); exit(); } } What am I not doing right. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2009 Share Posted December 14, 2009 you failed to mentioned what is not working and exactly your trying to do Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 echo these values and check, also do one thing. use the unset($_SESSION['type']);unset($_SESSION['name']);unset($_SESSION['level']); to unset the cookies and clear ur browser and check it out again.. if possible paste ur entire code back here.. so that it would be useful to resolve it properly Quote Link to comment Share on other sites More sharing options...
jmr3460 Posted December 14, 2009 Author Share Posted December 14, 2009 OK thanks for the fast reply. This block of script is supposed to redirect the user to the regional admin page if the $_SESSION ['type'] is set to regional. When I echo $_SESSION['type'] it echos regional so the session type is set to the correct name I just need the block to return true so the redirect will happen. Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 try this instead of header function echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=all_admin.php\">"; Quote Link to comment Share on other sites More sharing options...
jmr3460 Posted December 14, 2009 Author Share Posted December 14, 2009 Sorry for your troubles. I found it. I have been changing some things with the site. I am moving the admin folder to another and I am changing $_COOKIE (which is easy but not as versatile) to $_SESSION. I had an if statement checking for $_COOKIE in front of the $_SESSION. Thanks for the replies though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.