I think the easiest way would be to set a session variable. When you validate the user's logging in, you most likely make a query to your DB to check if the login and password match. If they do, you can do something like this:
Code:
(If the user has logged in succesfully)
$_SESSION[logged_in] = TRUE;
$_SESSION[user_login] = (either your $_POST[login] or your result from the database);
Then on any page (as long as you start it with session_start() of course), you can echo something like this:
Code:
if ($_SESSION[logged_in] == TRUE) {
echo 'Hello '.$_SESSION[user_login].', welcome to my website.';
}
else {
echo 'Hello guest, welcome to my website. Why not sign up for free?';
}
P.S. When I say it may be the easiest way, that's according to my limited PHP/SQL skills. I've been using something similar and it works perfectly. Hope that helps anyway.