Login page in PHP


CSS: 


Source Code:


<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "demo";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd)
or die("Could not select database");
if(isset($_POST['submit'])!="")
{
$name=$_POST['username'];
$pwd=$_POST['password'];
$sel=mysql_query("Select * from login where name='$name' and password='$pwd'");
$result=mysql_num_rows($sel);
if($result)
{
Header("location:view.php");
}
else
{
echo "<script>alert('Invaild User ');</script>";
}
}
?>


Html


<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<form id="login" method="post"><h1>Log In</h1>
<fieldset id="inputs"><input id="username" type="text" placeholder="Username" name="username" autofocus required autocomplete="off">
<input id="password" type="password" placeholder="Password" name="password"required autocomplete="off">
</fieldset><fieldset id="actions"><input type="submit" id="submit" name="submit" value="Log in">
<a href="">Forgot your password?</a><a href="">Register</a></fieldset> </form>
</body>
</html>