Quick update... Here's a version of the script that's cleaned up a bit, and will check to see if the user's logged in via a cookie. If so, they'll get "Welcome [Username]" otherwise they'll get a login screen.
http://cdnarmy.ca/deleteme/phplogin.txt It's meant to be included as part of a larger page (I.E. in a content island), rather than be a page all on it's own.