[Solved] Quick thing, make file accessible only by admin, php


If you want to do conditional includes then you should just add a check to see if the user is logged in and include the file if they are. I don’t know how you implemented the login and authentication stuff but based on the info you provided it would be like so:

<body> 
    <?php include('lock.php'); 
    if($login_session != 'admin') { // or however else you would check the login status
        echo "<h1> Please Log In </h1>";
    } else {
        include('hostess.php'); // include and display all the rest of the stuff
        // display the stuff
    ?>
    <div id="menu">  
        <ul> 
            <li><a href="https://stackoverflow.com/questions/11052579/logout.php">log out</a></li> 
        </ul>
    </div>
    <h1> Welcome <?php echo $login_session; ?> </h1>
    <?php } // close else ?>
</body>

solved Quick thing, make file accessible only by admin, php