<?php
session_start();
    require_once("../_config/connect.php");
if(isset($_POST['btnsubmit'])){

$uname=mysqli_real_escape_string($conn,$_POST['txtuname']);
$pwd=md5($_POST['txtpwd']);
$sele=mysqli_query($conn,"SELECT * FROM tbl_user WHERE username='$uname' AND password='$pwd'");
    $query=mysqli_fetch_array($sele);
    $count_str=mysqli_num_rows($sele);
    
    if($count_str > 0){ 
        

        $_SESSION["login"]="OK";
        $_SESSION["name"]=$query['full_name'];
        $_SESSION["user_id"]=$query['user_id'];
		$_SESSION["type"]=$query['user_type'];
        ?>
			<script type="text/javascript">
                window.location.href="system";
            </script>
        <?php
    }
    else{
        //header("location:index.php");
        $msg="<font style='font-family:Arial;color:red; font-size:16px;'>Invalid Username and Password</font>";
    }
}
?>

<!doctype html>
<html lang="en"><head>
    <meta charset="utf-8">
    <title>EURO ASIA CAMBODIA</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">

    <script src="lib/jquery-1.11.1.min.js" type="text/javascript"></script>

    

    <link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
    <link rel="stylesheet" type="text/css" href="stylesheets/premium.css">

</head>
<body class=" theme-blue">

    <!-- Demo page code -->

    <script type="text/javascript">
        $(function() {
            var match = document.cookie.match(new RegExp('color=([^;]+)'));
            if(match) var color = match[1];
            if(color) {
                $('body').removeClass(function (index, css) {
                    return (css.match (/\btheme-\S+/g) || []).join(' ')
                })
                $('body').addClass('theme-' + color);
            }

            $('[data-popover="true"]').popover({html: true});
            
        });
    </script>
    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { 
            color: #fff;
        }
    </style>

    <script type="text/javascript">
        $(function() {
            var uls = $('.sidebar-nav > ul > *').clone();
            uls.addClass('visible-xs');
            $('#main-menu').append(uls.clone());
        });
    </script>
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
       
<div class="dialog">
    <div class="panel panel-default" style="width:400px;">
    		<img src="img/bg_login.png" style="margin-left:-9px; margin-top:10px; width:408px;"/>
        	<p style="margin-top:-33px; margin-left:20px; color:#FFF;">PLEASE LOGIN</p>
	         <div class="panel-body" style="padding:20px;">
	            <form method="post" enctype="multipart/form-data">
	                <fieldset>	                    
	                    <div class="form-group input-group">
	                        <span class="input-group-addon"><i class="fa fa-user" style="color:#76a20e;"></i></span>
	                        <input type="text" name="txtuname" class="form-control" placeholder="UserName" required="true" autocomplete="off" style="height:30px;">
	                    </div>
	                    <div class="form-group input-group">
	                        <span class="input-group-addon"><i class="fa fa-lock" style="color:#76a20e;"></i></span>
	                        <input type="password" name="txtpwd" class="form-control" placeholder="Password" required="true" autocomplete="off" style="height:30px;">
	                    </div>
	                    <!-- Change this to a button or input when using this as a form -->
	                    <input type="submit" name="btnsubmit" value="LOGIN" class="btn btn-lg btn-success btn-block" style="line-height:15px; background:#8bb827; margin-top:25px;"/>
	                </fieldset>
	            </form>
	        </div>
	        <div style="border:0px solid #F00; text-align:center; margin-top:-10px; margin-bottom:10px;">
	        <?php
	                if(!empty($msg)){
	                echo $msg;
	                }
	            ?>
	       </div>
    </div>
    <h1 align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:14px;">&copy; <?php echo date('Y');?> EURO ASIA CAMBODIA</h1>  
</div>
</div>
    <script src="lib/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
    </script>
    
  
</body></html>
