Something like this would work:
PHP Code:
<?php
if (isset($_COOKIE["loggedin"]))
include('validuser.php');
echo "Welcome " . $_COOKIE["user"] . "!<br />";
else
include('guest.php');
echo "Welcome guest!<br />";
?>
You'd need to set the cookie named "loggedin" to something when the user logs in by using the setcookie() function. This is a pretty basic system.
Remember that using cookies is not a secure way to do this, because anyone could set a cookie. If really need the extra security you'd have to issue each visitor a unique key which is stored in a cookie, and then check that key against the user's logged in data (which would be handled by sessions).