PHP program to check the user login.

CODE:

login.html:

<html>
<head><link href="style.css" rel="stylesheet" type="text/css"/></head>
<body bgcolor="pink">
<form action="login.php" method="post">
<h1><center>LOGIN FORM</center></h1>
<table border=1 align="center">
<tr><td>Username</td>
<td><input type="text" name="uname"></td></tr>
<tr><td>Password</td><td><input type="password" name="pwd"></td></tr>
<tr><td><input type="submit" value="LogIn"></td></tr>
</table>
</form>
</body>
</html>

login.php:

<?php
$uname=$_REQUEST['uname'];
$pwd=$_REQUEST['pwd'];
$conn=mysql_connect("localhost","root","gasc");
mysql_select_db("gasc110",$conn);
$query="select * from login where uname='$uname'";
$query1=mysql_query($query);
while($row=mysql_fetch_array($query1))
{
if(($row['uname']==$uname)&&($row['pwd']==$pwd))
{
echo "welcome";
}
else
echo "invalid";
}
?>
<body bgcolor="cyan'">

</body>
</html>

style.css:

<html>
<head>
<style type="text/css">
#menu a
{
text_decoration:none;
}
# menu a:hover
{
background-color:#00ffaa;
}
</style>
</head>
</html>

OUTPUT:




Comments

POPULAR POSTS

POPULAR POSTS