<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template">
<meta name="author" content="GeeksLabs">
<meta name="keyword" content=" Responsive, Retina, Minimal">
<link rel="shortcut icon" href="img/favicon.png">
<title>Admin | Login</title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- bootstrap theme -->
<link href="css/bootstrap-theme.css" rel="stylesheet">
<!--external css-->
<!-- font icon -->
<link href="css/elegant-icons-style.css" rel="stylesheet" />
<link href="css/font-awesome.css" rel="stylesheet" />
<!-- Custom styles -->
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet" />
<!-- HTML5 shim and Respond.js IE8 support of HTML5 -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<form class="login-form" action="" method="post">
<div class="login-wrap">
<p class="login-img"><i class="icon_lock_alt"></i></p>
<div class="input-group">
<span class="input-group-addon"><i class="icon_profile"></i></span>
<input type="text" name="username" class="form-control" placeholder="Username" autofocus>
</div>
<div class="input-group">
<span class="input-group-addon"><i class="icon_key_alt"></i></span>
<input type="password" name="password" class="form-control" placeholder="Password">
</div>
<input name="submit" class="btn btn-primary btn-lg btn-block" type="submit" Value="Login">
</form>
<?php
if(isset($_POST['submit'])){
include("connection.php");
$username=$_POST['username'];
$password=$_POST['password'];
$query=mysql_query("SELECT * FROM login WHERE username='$username' and password='$password'");
$row=mysql_fetch_array($query);
if($row){
session_start();
$_SESSION['username']=$row[0];
header('location:admin.php?success');
exit(0);
}else
{
echo '<p style="color:red; text-align:"center"> Invalid Username and Password. </p>';
}
}
?>
</div>
</div>
</body>
</html>