Login and user authentication is the most common feature in any dynamic website. We are going to create a simple login system using PHP code on our pages, and a MySQL database to store our users information. The rar file contains the complete PHP MySQL Login source code of our authentication script and a MySQL file to create and populate the required tables.
Cool Login Form With PHP, MySQL and jQuery
Connection.php
<?php
// connect to database
$con = mysql_connect(“localhost”,”root”,”technology”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
//Select Database
mysql_select_db(“logindb”, $con);
?>
Login.php
<?php
// Database connection
include(“connection.php”);
// AJAX JQuery Validation
include(“validation/validation.php”);
// Condition checks Submit button is set or not
if(isset($_POST[“btnlogin”]))
{
// Select username and password from admin table
$result = mysql_query(“SELECT * FROM admin WHERE username=’$_POST[adminid]’ AND password=’$_POST[password]'”);
// Query checks Entered user id is valid or not…
if(mysql_num_rows($result) == 1)
{
// redirects to admindashboard.php
header(“Location: admindashboard.php”);
}
else
{
// “Login Failed.. Please try again” message stores in variable $abc
$abc=”Login Failed.. Please try again”;
}
}
?>
<form name=”formID” id=”formID” method=”post” action=””>
<p align=”center”><b> <u><h2>Login Page </h2></u><br>Enter User ID and Password to Login website <br>
<font color=”#FF0000″>
<?php
// prints if its invalid password
echo $abc;
?>
</font></b>
</p>
<p> <strong>User Name :
<input type=”text” name=”adminid” id=”adminid” />
</strong></p>
<p><strong>Password :
<input type=”password” name=”password” id=”password” />
</strong></p>
<p>
<strong>
<input type=”submit” name=”btnlogin” id=”btnlogin” value=”Login” />
<input type=”reset” name=”button2″ id=”button2″ value=”Reset” />
<br />
</strong></p><p> </p><p> </p>
<p>
</form>
Table Design :
DOWNLOAD NOW 🔥647
6 Comments
shalu
June 6, 2012 - 10:18 AMVery very thanks…
firstedgar
December 28, 2012 - 8:34 PMfirstedgar
December 28, 2012 - 8:36 PM// prints if its invalid password
// echo $abc
function failed() {
global $abc;
echo $abc;}
failed()
sagar
December 31, 2012 - 8:22 AMamazing …..thanks.
prag
September 23, 2013 - 9:42 PMcan i get the complete synopsis for this project?send it to prajnakornaya14@gmail.com
prag
September 23, 2013 - 10:59 PMcan i get the complete synopsis for this project?send it to pajju14@rediffmail.com