Program :
File name : Login.html
<!DOCTYPE><html>
<head>
<title>Login Page</title>
</head>
<body>
<center><h2>LOGIN PAGE</h2></center>
<form action="admin_home.php" name="login" method="post">
<table width="266" height="0" border="0" align="center">
<tr> <td width="70" align="left" ><br>Username </td>
<td width="153" align="left" ><br><input type="text" name="user_id" id="user_id"></td> </tr>
<tr> <td align="left" >Password </td>
<td align="left" ><input type="password" name="user_password" id="user_password"></td> </tr>
<tr><td> </td>
<td><center><input name="login" type="submit" value="Login"></center></td>
</tr>
</table>
</form>
</body>
</html>
PHP Script Filename : admin_home.php
<?php$a=$_POST["user_id"];
$b=$_POST["user_password"];
$con=mysql_connect("localhost","root","");
mysql_select_db("stu",$con);
$sel=mysql_query("select * from login",$con);
$row_rs=mysql_fetch_assoc($sel);
if (($row_rs['user_id']==$a)&&($row_rs['user_password']==$b))
{
echo "Login Successful . . . ";
}
else
{
echo "Login Failed. Please Check User Name and Password";
}
?>
0 comments:
Post a Comment