Make me one table and three files Table ------------- Has a username and a password and a cookie Username is unique and not null Password is not null Login Check page ---------------- Never prints anything if the cookie is wrong ... header("location: login.php"); Add a user page -------------- require the login check page Ask for a username and a password Encrypt the password Insert into the table the username and the password Login page --------------- Ask for a username and a password Encrypt the password If the username and the password exist, say yes pick a random number to be the cookie set the cookie modify the table to set the cookie in the table else say no Search the database like this: select count(users) where username=XXX and password=XXX