I do all of that through a file called config.php.

config.php checks cookies and compares them with the database, and if all is valid, it sets up a variable called $CONFIG['user'] and lets the user proceed.

Also, if all is valid, I refresh the cookies to keep them logged in.

I include config.php in every page that I need this, and use $CONFIG['user'] to see whether or not they're logged in, and decide what to show them or where to direct them to.

I'm sure there's other ways, but that's how I do it in my news manager.