Our Scripts Vault contains many game scripts that you can use to create your own game!
As far as the actual login parameters themselves, I use a hashing method on the user's password immediately upon receiving it at registration and I also hash the received password at login time and compare them. If the hashes are identical, the user has successfully authenticated.
As far as handling SQL injection, I use prepared statements with bound parameters to foil it.