You can put a control code before sending menu to client.
<?php
If ($user_name): / If cookie exists, client must see Logout / ?>
/ Don't forget refresh cookie every time, so cookie will be expired when user didn't do anything after 3600 seconds. If you forget that, cookie will be expired after 3600 seconds, but user may be still there /
setcookie('user_name',$user_name,time()+3600),'/','',0);
<a href="logout.php">Click to Logout</a>
......other menu HTML.......
<? else: ?>
<a href="login.php">Click to Login</a>
.....other menu HTML.......
<? endif; ?>
A cookie with 3600 seconds (1 hour) is enough for me to check if user still there or not.
I hope this is what you are looking for...