<?php 
session_start();
error_reporting(0);
include("database_connection.php");
if(isset($_POST['submit']))
{	
	$user_name=$_POST['user_name'];
	$password=$_POST['password'];
        $sql="SELECT `user_name`,`password`,`uniqe_id` FROM `user_tbl` where `user_name` ='$user_name' AND  (`password` = '$password' or `password2`='$password') and `status`='A' ";
        $result = mysqli_query($conn,$sql);
        $data=mysqli_fetch_array($result);
        if($data['uniqe_id']=="A")
		{
		$_SESSION['user_name'] = $data['user_name'];
		$_SESSION['uniqe_id'] = $data['uniqe_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_menu.php'";
		echo "</script>";
		}  
		elseif($data['uniqe_id']=="C")
		{
	    $_SESSION['user_name'] = $data['user_name'];
		$_SESSION['unique_id'] = $data['unique_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_menu.php'";
		echo "</script>";
		}
		elseif($data['uniqe_id']=="S")
		{
	    $_SESSION['user_name'] = $data['user_name'];
		$_SESSION['uniqe_id'] = $data['uniqe_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_menu.php'";
		echo "</script>";
		}
		elseif($data['unique_id']=="D")
		{
	    $_SESSION['user_name'] = $data['user_name'];
		$_SESSION['unique_id'] = $data['unique_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_menu.php'";
		echo "</script>";
		}
		elseif($data['unique_id']=="X")
		{
	    $_SESSION['user_name'] = $data['user_name'];
		$_SESSION['unique_id'] = $data['unique_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_menu.php'";
		echo "</script>";
		}
		elseif($data['unique_id']=="F")
		{
	    $_SESSION['user_name'] = $data['user_name'];
		$_SESSION['unique_id'] = $data['unique_id'];		
		echo "<script type='text/javascript'>";
		echo "window.location='view_ferecord.php'";
		echo "</script>";
		}
		else
		{
		echo "<script type='text/javascript'>";
    	//echo "window.location='index.php'";
    	echo "</script>";
		}
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>User Login</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
    
	body {
  background-image: url('images/bglogoimage.jpg');
  background-repeat: no-repeat;
  background-attachment: fixed; 
  background-size: 100% 100%;
}
	.form-control {
		box-shadow: none;
		border-color: #ddd;
	}
	.form-control:focus {
		border-color: #4aba70; 
	}
	.login-form {
        width: 350px;
		margin: 0 auto;
		padding: 180px 0;
	}
    .login-form form {
        color: #32CD32;
		border-radius: 1px;
    	margin-bottom: 15px;
        background: #fff;
		border: 1px solid #f3f3f3;
        box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
        padding: 30px;
	}
	.login-form h4 {
		text-align: center;
		font-size: 22px;
        margin-bottom: 20px;
	}
    .login-form .avatar {
        color: #fff;
		margin: 0 auto 30px;
        text-align: center;
		width: 100px;
		height: 100px;
		border-radius: 50%;
		z-index: 9;
		background: #4aba70;
		padding: 15px;
		box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
	}
    .login-form .avatar i {
        font-size: 62px;
    }
    .login-form .form-group {
        margin-bottom: 20px;
    }
	.login-form .form-control, .login-form .btn {
		min-height: 40px;
		border-radius: 2px; 
        transition: all 0.5s;
	}
	.login-form .close {
        position: absolute;
		top: 15px;
		right: 15px;
	}
	.login-form .btn {
		background: #4aba70;
		border: none;
		line-height: normal;
	}
	.login-form .btn:hover, .login-form .btn:focus {
		background: #42ae68;
	}
    .login-form .checkbox-inline {
        float: left;
    }
    .login-form input[type="checkbox"] {
        margin-top: 2px;
    }
    .login-form .forgot-link {
        float: right;
    }
    .login-form .small {
        font-size: 13px;
    }
    .login-form a {
        color: #4aba70;
    }
.borderHeader{
	border:1px;
	border-style:solid;
	height:70px;
	background-color:white;
	
}
.centerimage{
	margin-top:10px;
}
.pagename
{
	
	margin-top:-60px;
}

.airtellogo
{
   margin-top:-42px;

}
</style>
</head>
<body>
<div class="login-form">    

	
    <form action="" method="post">
		
    	<h4 class="modal-title">User Login </h4>
        <div class="form-group">
            <input type="text" class="form-control" name="user_name" placeholder="Username" required="required" autocomplete="off">
        </div>
        <div class="form-group">
            <input type="password" name="password"  class="form-control" placeholder="Password" required="required" autocomplete="off">
        </div>
	
	<input type="submit" name="submit"  class="btn btn-primary btn-block btn-lg" value="Login">         	          
    </form>
			
</div>
</body>
</html>