UPDATE, 2016
Please use only existing login systems that are provided out of the box in almost every PHP infrastructure! There is absolutely no reason to write this yourself, as user authentication is a big topic, and it will take several months (years) to write a serious, stable and modern login solution.
ORIGINAL TEXT, Since 2012:
Since login systems are a security issue and EVERYBODY repeats the same errors over and over again, I can clearly say:
Take a professional script and work through the code to understand what is happening, what hashing and salting are, and what problems sessions may have.
Try this baby: http://php-login.net
source share