DevShed has posted a tutorial, the first of a series of framework components they're going to look at - the login/logout pieces so many websites use.
The first of the Framework components that we are going to be looking at is central authorization. This component contains two classes, the login and logout classes. Not only do these classes log a user in and out, they also record the times and dates that a user logged in and logged out.
They include all you'll need to create this component - the class to handle the login/logout requests, the SQL you'll need for the matching database and the rest of the code to wrap it up. A brief look at its use is also included.