I am posting this code snippet as I continue to see login and user registration scripts that store passwords in databases as unsalted md5 hashes, and passwords in cookies as raw text.
This snippet includes an example user registration function, as well as an example user login, login check, and logout function.
XOR base64 functions are also included, as they are required for the login and login check. I did not write these functions and found them some time ago online. I can't remember where.