SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

PHP Login Form to enter userid and password Part I

Login script is a very common requirement of many websites. How to create one login script ? There are three steps involved in developing a login script. First asking user or member to login using a form. Then checking the entered information with one existing table of a database. Allowing the member to enter into restricted area based on successful login. We will use PHP to develop this login script part II and we assume that all our member data is available and stored in a table on MySQL database. We are not discussing here on how to connect to MySQL database by using PHP. You can get the connecting string and all other details at PHP mysql connection

Now let us first display the form asking the member to enter their login ID and password. We will create one form and you can use the php form validation techniques discussed here to validate the form. Here is the code to display a simple login form.

<form action='loginck.php' method=post>
<table border='0' cellspacing='0' cellpadding='0' align=center>
<tr id='cat'>
<tr> <td bgcolor='#f1f1f1' ><font face='verdana, arial, helvetica' size='2' align='center'>  Login ID    
</font></td> <td bgcolor='#f1f1f1' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='userid' ></font></td></tr>

<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'>  Password
</font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='password' ></font></td></tr>

<tr> <td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
<input type='submit' value='Submit'> <input type='reset' value='Reset'>
</font></td> </tr>

<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'>  <a href='signup.php'>New
Member Sign UP</a></font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' > Forgot Password ?</font></td></tr>

<tr> <td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
 </font></td> </tr>

</table></center></form>

Related Tutorial
Forgot password script
PHP Change Password
PHP Signup script
PHP Login Logout

This will display the login form for us. Member has to enter the login ID and password in two text boxes displayed in the form. On submit the login ID and password get carried to the page loginck.php were we will be checking all the entered values of the member.

We have to now check the entered id and password against existing data in the table. Please note that we will use the same table used for PHP signup script tutorial so you can use this as a continuation of the signup tutorial. Members can signup and then login. You can download the zip file at the end of this tutorial to install both the signup and login script for your testing.

Next we will discuss about the loginck.php file which takes the login data from above form and checks the member table.

Sample login form

 Login ID    
 Password
 New Member Sign UP Forgot Password ?
 

Download PHP signup with login script
Download Modified PHP signup with login script if register_global is off for PHP 5

Discuss this tutorial at forum


Further readings
Online membership management script
Posting Activation key for lost encrypted password to the email address
Creating a signup page and storing member details in MySQL
Storing signup data in a table
Collecting the data if register global is off for signup script
Changing or updating password by the logged in member
Forgot password feature in member signup script
Basic login form
Login script to authenticate user from a mysql table data
Checking the status of user for login or logged out
Updating member profile inside member area
Finding out who are online








 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorial Index
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
PHP Tutorials
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.