This is generally a simple task.
Once your user has logged and while you are still in the login process (keep in mind that the cookie set below is the most rudimentary cookieset available. For more controls, such as security levels, paths, etc. you should read further (or just ask and I will be more than happy to write a faq for you)):
//session only
$exp = time();
//8 hours
$exp = time() + (60*60*8);
//1 day
$exp = time() + (60*60*24);
//'forever' (cookies cannot be stored forever, all cookies have to expire and typically they only last for 1 year)
$exp = time() + (60*60*24*365);
//set your cookie
setcookie("my_session[0]",$name,$exp);
Now on your pages, you just do something like:
if($my_session) {
//yell hello!
echo "Hello, ".$my_session[0];
}
else {
//inform user they should login to experience
//the best level of options, etc.
echo "You are not logged in...";
}
That is it!
The cookie automatically expires, thus after say 8 hours which I chose to remain logged in, I will receive the "you are not logged in... " stuff instead of my welcom message.
This can also be extended to limited functionality on your site (restricted areas, etc).
Hope this helps.
Chad.