I have a navigation bar I include in my pages, which worked fine as long as all the php files were in the same dir. Once I moved them into folders the navigation bar would only allow one link to be clicked then once in a lower dir the pathing to files were incorrect.
Dir structure:
php-->
navpanel.php
search.php
-
user folder
checkusername.php
etc php files
-
database folder
- createdatabase.php
js-->
- js files
php code im using which is included in the other files.
<?php
$path = $_SERVER["DOCUMENT_ROOT"];
echo $path;
if ($_SESSION['admin'] == 1){
echo '
<body>
<ul id="menu">
<li><a href="search.php">Search</a></li>
<li><a href="#"></span> User</a>
<ul>
<li><a href="user/createuser.php">Create User</a></li>
<li><a href="user/edituser.php">Edit User</a></li>
<li><a href="user/deleteuser.php">Delete User</a></li>
<li><a href="user/usergroup.php">User Groups</a></li>
</ul>
</li>
<li><a href="#">Databases</a>
<ul>
<li><a href="database/createdatabase.php">Create Database</a></li>
<li><a href="database/editdatabase">Edit Database</a></li>
<li><a href="database/deletedatabase">Delete Database</a></li>
<li><a href="database/databasegroup">Database Groups</a></li>
</ul>
</li>
<li><a href="../connect/logout.php">Log Out</a></li>
</ul>
</body>';
}
else {
echo '
<body>
<ul id="menu">
<li><a href="search.php">Search</a></li>
<li><a href="connect/logout.php">Log Out</a></li>
</ul>
</body>
';
}