[eluser]Jamie Rumbelow[/eluser]
Try looking around the current authentication libraries and seeing how they work and what they're doing. That way you'll be able to understand the login process a lot clearer. Heck, you might even find a system that works for you, saving you from developing one!
Jamie