first you need a database with the username and password list MySQL
now in the login page you will need to have a form html tage for username and password also the form needs to link to the page with the validation script
on the page with the validation script you will need to have a line of code to connect to the database
next you will need a line of code that checks to make sure the username and password are valid in the database
finaly you will want to use an if else code to set the cookie and also give the message if they logged in incorrectly.