If this is not some exercise when you need to implement your own authentication sequence, I would suggest using OpenID to do weightlifting. It's simple, many sites use it, and you will get rid of many problems with security, encryption, etc.
You can read about the Zend framework for OpenID here , as well as a tutorial on how to use it here .
source share