Here is another tutorial that goes a little further than the previous one:
http://www.phpfreaks.com/tutorials/65/0.php
As for testing whether or not a user is logged in, you can do this by using sessions and testing whether or not the session variables are set. If they are not set then the user is not logged in, and you can either include the login form on that page, or redirect them to a page containing the login form.
To log them in after they have closed the browser, you need to use cookies.
There are many tutorials out there that can help you with these topics. Look around... it'll give you more ideas of what can be done!
HTH