how login authentication built

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
naeem1984
Forum Newbie
Posts: 10
Joined: Thu Feb 26, 2009 3:55 am

how login authentication built

Post 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
Yoni
Forum Newbie
Posts: 6
Joined: Sat Oct 28, 2006 11:56 pm

Re: how login authentication built

Post 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.
Post Reply