How you will show or hide the logout link will depend on how your login is setup. How do you determine if a user is logged in or not? Are you setting any session variables when a user logs in? If so you can check for these variables having a value to determine if you should show the logout link like this:
<?php if (isset($_SESSION['userID']) || $_SESSION['userID'] != ""){ //user is logged in ?>
<a href="your logout page">logout</a>
<?php } else { //the user is not logged in ?>
<a href="your login page">login</a>
<?php } ?>

