Articles: 843 | Categories: 148   
   
   
Home Articles Contact Us
 
 
 
 
User Authentication (0 Comments)
Admin: Posted Date: April 4, 2010

This tutorial will show you how to add user authentication to your website. Now if the username and password is right you wil be allowed access, but what if incorrect login is submitted? Simply add the following code at the bottom.

User Authentication The Form Below Contains Username, Password, and submit. Use it for you user login.

CODE

<form name="login" method="post" action="index.php">
Username:
<input type="text" name="xtasy">
<br>
Password:
<input type="text" name="is a pimp">
<br>
<input type="submit" name="Submit" value="Submit">
</form>

Save this form on a page called login.php
Now you will need to put this in the page you with to protect. The form above is protecting 'index.php'; if its
anything else please change the
form action in the above form.


CODE

<?php
if(isset())
{
if($username=="yourusername")
if($password=="yourpassword")
{
?>

Put the above code at the top of your index.php page.
Now if the username and password is right you wil be allowed access, but what if incorrect login is submitted?
Simple add the following code at the bottom.
CODE

<?php
}
else
print "You have entered the wrong username or password.";
}
?>

 

 
 
Add a Comment:
 
(You must be signed in to comment on an article. Not a member? Click here to register)
   
Title:

Comments: