The actual code will depend on where you are storing the valid usermane/password pairs the login script will go to to verify the username/password entered by the user.
Are you storing the username/passowrd pairs in a database, and if so which type of database or are you storing them in a text or some other type of file.