jesushax Posted July 1, 2008 Share Posted July 1, 2008 hi heres my codes when a user has logged in the session "UserAccess" is set to 1 this is fine, but if you see where the includes are for admin_menu or user_menu, when im logged in i get the user_menu for some reason now the userAccess session is already approved as 1 if it wasnt the access.inc code would of kicked the user out, i cant understand why the admin_menu is not getting displayed when it should be... :S Any ideas? Thanks admin.php <?php include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/connection.php'); session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/access.inc'); include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/header.php'); ?> Admin <?php include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/footer.php'); ?> access.inc <?php if ($_SESSION["UserAccess"] =! "1"){ header("Location: /new/admin/index.php?action=adminonly"); } ?> header.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Construction Works</title> <link href="/new/includes/css/layout.css" rel="stylesheet" type="text/css" /> <link href="/new/includes/css/styles.css" rel="stylesheet" type="text/css" /> <script src="/new/includes/java/switch.js" type="text/javascript"></script> <?php include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/date.php'); ?> </head> <body> <div id="container"> <div id="header"> <div id="header-left"></div> <div id="header-right"></div> <div id="header-content"><img src="/new/images/layout/header.png" alt="header"/></div> </div> <div id="content"> <div id="content-left"> <?php if (isset($_SESSION["UserAccess"])){ if ($_SESSION["UserAccess"] == "1") {include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/nav/admin_menu.php'); echo"yes";} else {include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/nav/user_menu.php'); echo"no 1";} } else { include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/nav/user_menu.php'); echo"no 2";} ?> </div> <div id="content-top"></div> <div id="content-right"> <div id="content-text"> <div class="bg"> Link to comment https://forums.phpfreaks.com/topic/112769-solved-wrong-include-session-error-maybe-its-confusing/ Share on other sites More sharing options...
MatthewJ Posted July 1, 2008 Share Posted July 1, 2008 <?php if ($_SESSION["UserAccess"] =! "1"){ header("Location: /new/admin/index.php?action=adminonly"); } ?> Should'nt that be <?php if ($_SESSION["UserAccess"] != "1"){ header("Location: /new/admin/index.php?action=adminonly"); } ?> != instead of =! Link to comment https://forums.phpfreaks.com/topic/112769-solved-wrong-include-session-error-maybe-its-confusing/#findComment-579194 Share on other sites More sharing options...
jesushax Posted July 1, 2008 Author Share Posted July 1, 2008 thats done it! strange cos i did that before cos i coudlnt remember which way to do it and it didnt work, but meh it works now so... Thanks Link to comment https://forums.phpfreaks.com/topic/112769-solved-wrong-include-session-error-maybe-its-confusing/#findComment-579198 Share on other sites More sharing options...
MatthewJ Posted July 1, 2008 Share Posted July 1, 2008 I know the feeling! Don't mention it Link to comment https://forums.phpfreaks.com/topic/112769-solved-wrong-include-session-error-maybe-its-confusing/#findComment-579209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.