<?php
session_start();
include("config.php");
?>
<!doctype html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>Gala 2014 Admin</title>
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/animate.css">
	<link rel="stylesheet" href="css/styles.css">
	<script language="text/javaScript" src="js/validations.js"></SCRIPT>
</head>
<?php
    if(isset($_POST['login'])){
        $username = $_POST['username'];
        $password = $_POST['password'];
        if($username =="admin" && $password == "admin"){
            $_SESSION['username'] = $username;
            ?>
                <script>window.location="home.php"</script>
            <?php
        }
        
    }
    
?>

<body>
	<div id="container">
		<form name="Login" id="Login" method="POST" action="" onsubmit="return validateVolunteers1()">
			<span id="usernameError" class="error"></span><br/>
			<label for="name">Username:</label>
			<input type="name" name="username" id="username">
			<label for="username">Password:</label>
			<!--<p><a href="#">Forgot your password?</a>-->
			<input type="password" name="password" id="password">
			<div id="lower">
				<!--<input type="checkbox"><label class="check" for="checkbox">Keep me logged in</label>-->
				<input type="submit" value="Login" name="login">
			</div>
		</form>
	</div>
</body>


<script type="text/javascript">
function validateVolunteers(){
	var username = document.getElementById('username').value;
	var password = document.getElementById('password').value;
	if(username == '' || password == ''){
		document.getElementById('usernameError').innerHTML="Please enter username and password";
		//alert("Please enter username and password");
		return false;
	}
}
function validateVolunteers1(){
	var username = document.getElementById('username').value;
	var password = document.getElementById('password').value;
	if(username == '' || password == ''){
		document.getElementById('usernameError').innerHTML="Please enter username and password";
		//alert("Please enter username and password");
		return false;
	} else if(username != "admin" || password != "admin"){
    document.getElementById('usernameError').innerHTML="Please enter valid username and password";
    return false;
}
</script>

<style>
.error{
	font-size:12px;
	color:red;
	padding-left:60px;
}
</style>

