mikebrowntsbod Posted October 8, 2017 Share Posted October 8, 2017 (edited) So when I am going from index.php and /applications/add.php they show two different menus. /index.php <body> <?php include "includes/menu.php"; ?> <!--<a class="navbar-brand" href="#"><strong>Home</strong></a>--> <p class="navbar-brand"><strong>Home</strong></p> <?php include "includes/lowermenu.php"; ?> <?php include "includes/rolecheck.php"; ?> <?php echo '<div id="accordion"> <h3>Administrative News</h3> /includes/lowermenu.php <?php include_once ('/includes/rolecheck.php'); echo ' </div>'; /*Collect the nav links, forms, and other content for toggling */ echo '<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="/index.php">Home</a></li>'; if (in_array(11,$userRoles)) { echo '<li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Election<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/election/vote.php">Vote</a></li> <li><a href="/election/results.php">Results</a></li> </ul> </li>'; } if (in_array(2,$userRoles)) { echo' <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Architecture<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/applications/add.php">Add Application</a></li> <li><a href="/applications/view.php">View Applications</a></li> <li><a href="/applications/vote.php">Vote</a></li> <li><a href="/applications/modify.php">Modify Application</a></li> <li><a href="/applications/remove.php">Remove Application</a></li> <li class="divider"></li> <li><a href="/applications/addfinal.php">Add Final Pictures</a></li> </ul> </li>'; } if (in_array(11,$userRoles) || in_array(3,$userRoles) || in_array(4,$userRoles)) { echo' <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Violations<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/violations/add.php">Report Violation</a></li> <li><a href="/violations/boardHearings/request.php">Request a Board Hearing</a></li>'; if (in_array(3,$userRoles) || in_array(4,$userRoles)) { echo'<li><a href="/violations/boardHearings/results.php">Board Hearing Results</a></li> <li><a href="/violations/boardHearings/schedule.php">Schedule Hearing</a></li>'; } echo '</ul> </li>'; } echo '<li><a href="/user/messages.php" class="nav-link disabled">Messages</a></li>'; if (in_array(11,$userRoles) || in_array(4,$userRoles)) { echo '<li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Parking<b class="caret"></b></a> <ul class="dropdown-menu">'; if (in_array(4,$userRoles) || in_array(3,$userRoles)) { echo '<li><a href="/parking/towing/addVehicle.php">Add Vehicle (Towing)</a></li> <li><a href="/parking/towing/updateVehicle.php">Update Vehicle (Towing)</a></li>'; } if (in_array(11,$userRoles)) { echo '<li><a href="/parking/violation.php">Report Violation</a></li> <li><a href="/parking/requestLongTermParking.php">Long Term Parking Request</a></li>'; } echo '</ul> </li>'; } if (in_array(3,$userRoles)) { echo '<li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Board <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/board/addMotion.php">Add Motion</a></li> <li><a href="/board/removeMotion.php">Remove Motion</a></li> <li><a href="/board/amendMotion.php">Amend Motion</a></li> <li><a href="/board/revokeMotion.php">Revoke Motion</a></li> <li><a href="/board/voteMotion.php">Vote</a></li> <li><a href="/board/boardHearingVote.php">Board Hearing Vote</a></li> <li><a href="/board/submitHearingNotes.php">Hearing Notes</a></li> </ul> </li>'; } if (in_array(11,$userRoles) || in_array(4,$userRoles) || in_array(14,$userRoles)) { echo '<li><a href="/reports.php">Reports</a></li>'; } echo '<li><a href="/user/profile.php">Profile</a></li> <li><a href="/login/logout.php">Logout</a></li> </ul>'; echo '<ul class="nav navbar-nav navbar-right">'; if (in_array(1, $userRoles)) { echo '<li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">Admin <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="/admin/addusers.php">Add User</a></li> <li><a href="/admin/removeusers.php">Remove Users</a></li> <li><a href="/admin/modifyusers.php">Modify Users</a></li> <li class="divider"></li> <li><a href="/admin/systemsettings.php">Settings</a></li> </ul> </li>'; } echo' </ul>'; echo ' </div> </div> </nav>'; ?> /includes/rolecheck.php <?php include_once ('dbconnect.php'); $userRoleSearch=$db_con->prepare("SELECT * FROM members m INNER JOIN userRoleGroups urg ON urg.userid = m.userid INNER JOIN userGroups ug ON ug.userGroupID = urg.userGroup_id WHERE m.username=:username"); $userRoleSearch->bindParam(':username', $_SESSION['username']); $userRoleSearch->execute(); $userRoles=array(); foreach ($userRoleSearch as $row) { //print $row["userGroupID"] . "-" . $row["userGroupName"] . "<br />"; $userRoles[] = $row["userGroupID"]; } ?> /applications/add.php <body> <?php include "../includes/menu.php"; ?> <!--<a class="navbar-brand" href="#"><strong>Home</strong></a>--> <p class="navbar-brand"><strong>Add App</strong></p> <?php include "../includes/lowermenu.php"; ?> <?php include "../includes/rolecheck.php"; ?> <!--Added Here--> <div class="container"> Edited October 8, 2017 by mikebrowntsbod Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 8, 2017 Share Posted October 8, 2017 Hey that's great. Thanks for telling us. Usually people post questions in this forum though. Quote Link to comment Share on other sites More sharing options...
mikebrowntsbod Posted October 8, 2017 Author Share Posted October 8, 2017 Hey that's great. Thanks for telling us. Usually people post questions in this forum though. Sorry I did not ask my question directly. My question is why is it happening? Quote Link to comment Share on other sites More sharing options...
mikebrowntsbod Posted October 8, 2017 Author Share Posted October 8, 2017 include_once ('/includes/rolecheck.php');I removed this from the lowermenu.php file. The call to /includes/rolecheck.php is now on each page. Quote Link to comment Share on other sites More sharing options...
mikebrowntsbod Posted October 8, 2017 Author Share Posted October 8, 2017 I am seeing the following in the apache2 error log [sun Oct 08 16:58:25.450123 2017] [:error] [pid 22895] [client 73.200.12.32:51826] PHP Warning: include(/includes/rolecheck.php): failed to open stream: No such file or directory in /var/www/html/arch1/applications/add.php on line 151, referer: https://portal.tanyardspringshoa.com/index.php [sun Oct 08 16:58:25.450193 2017] [:error] [pid 22895] [client 73.200.12.32:51826] PHP Warning: include(): Failed opening '/includes/rolecheck.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/arch1/applications/add.php on line 151, referer: https://portal.tanyardspringshoa.com/index.php [ Quote Link to comment Share on other sites More sharing options...
Solution mikebrowntsbod Posted October 9, 2017 Author Solution Share Posted October 9, 2017 I found what the issue was and it is now fixed. It was a path issue as it does not do absolute paths I have to give it a relative path 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.