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. Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/ 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 Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/#findComment-976791 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 Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/#findComment-976793 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. Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/#findComment-976799 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\">"; Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/#findComment-976802 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. Link to comment https://forums.phpfreaks.com/topic/185046-trouble-checking-session-cookie/#findComment-976838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.