Page 1 of 1

how login authentication built

Posted: Tue Apr 07, 2009 9:43 am
by naeem1984
how making login authentication
which authenticate username and password
if username and password authenticate from database then go to next page
otherwise redirect to login page

Re: how login authentication built

Posted: Tue Apr 07, 2009 6:54 pm
by Yoni
Hi there :)
Below I'll write down in basics how to do so... :)

Registertion page:
- Write a new file with HTML code that will ask the user to fill user name, password & etc... /* In the HTML code there should be a <form> tag with "method=post" option... & a submit button. */
- This information should be sent into a PHP script, this PHP script will store the username & all of the other details asked from the user - except for the PASSWORD- into the database.
- The PHP will convert the password to MD5 type /* $PASSWORD=md5($_POST['password']); */ & will store the result into the database as well... /* I like to work with the MD5 encryption type... it is very well documented over the Internet & don't take lot of process from the CPU.

Login page:
- Write a new file with HTML code that will ask the user to fill it's username & password /* In the HTML code there should be a <form> tag with "method=post" option... & a submit button. */
- This information should be sent into a PHP script, this PHP script will check if the username exists inside a specific database, if it so... it will convert the Password that the user has filled into an MD5 encryption & will match it with the user password inside the database.

If login succeeded use the header function to redirect the user to the next page & if not it will be redirected to the login page again.. /* header("Location: http://www.google.com"); */

This is the basic!!

Hope that I helped.