<?php 
include "config.php";
error_reporting(0);
if (isset($_POST['sub']))
{
	session_start();
	$user=$_POST['user'];
	$pass=$_POST['password'];
	 $sess=mysqli_query($connect,"select * from employeedetails where username='$user' && password='$pass' && status!='deleted' && statuslive ='1'");
	 if (mysqli_num_rows($sess) == 1)
	 {
	 $_SESSION['log'] = $_POST['user'];
			Header('Location:home.php');
	 }
		else
		{
			echo "<script>alert('Invalid username or Password')</script>";
		}
	 
}
?>
<html>
    <head>
    <link rel="stylesheet" href="fontawesome-free-5.15.1-web/css/all.css">
  <link rel="stylesheet" href="bootstrap/min.css">
  <script src="javascript/min.js" type="text/javascript"></script>
  <script src="bootstrap/jquery.min.js"></script>
  <script src="bootstrap/popper.min.js"></script>
  <script src="bootstrap/bootstrap.js"></script>
        <style>
            body
            {
                background-image:url("image/mountain2.jpg");
                 background-position: center;
            }
            .logo i
            {
                border-radius:20px;
                font-size:70px;
                color:rgba(161, 143, 93);
                
            }
            .logo
            {
                margin-left:230px;
                padding-top:20px;
            }
            .full-login 
            {
                background-color:rgba(228, 237, 230,0.7);
                width:500px;
                height:400px;
                margin:auto;
                margin-top:100px;
                border-radius:20px;
                font-family:timesnewroman;
            }
            h1
            {
                text-align:center;
                font-family:timesnewroman;
                padding-top:20px;
              
            }
             .inputtext,.inputtextdis
             {
                 width:300px;
                 background-color:rgba(228, 237, 230,0.4);
                 border:1px solid black;

             }
             .inputtext
             {
                 margin-bottom:40px;
             }
             .textfield 
             {
                 margin-left:100px;
                 margin-top:50px;
             }
             .chkbox
             {
                 margin-left:100px;
             }
             .forgot
             {
                 margin-left:120px;
             }
             .buttonsub
             {
                 margin-left:220px;
                 margin-top:30px;
             }
        </style>
    </head>
    <body>
        <div class="full-login">
        <!-- <div class="logo">
        <i class="fas fa-user-tie"></i>
        </div> -->
        <h1>LOGIN</h1>
        <div class="textfield">
            <form method="post" action="index.php">
            <input type="text" name="user" autocomplete="off" class="form-control inputtext" placeholder="Username">
            <input type="password" name="password" class="form-control inputtextdis" id="pass" placeholder="Password">
            <input type="text" class="form-control inputtextdis" id="passtext" placeholder="passwordd">
        </div>
        <br>
        <div><span class="chkbox"><input type="checkbox" id="showpass"> Show Password</span><span class="forgot"><a href="#"data-toggle="modal" data-target="#myModal" >Forgot Password</a></span></div>
    <input type="submit" name="sub" class="btn btn-warning buttonsub">  
            </form> 
    </div>
    <!--  -->
    <div class="modal fade" id="myModal">
    <div class="modal-dialog">
      <div class="modal-content">
      
        <!-- Modal Header -->
        
        
        <!-- Modal body -->
        <div class="modal-body">
            <form action="updatepassword.php" method="post">
        <input type="text" class="form-control " name="userpass" placeholder="Username"><br>
            <input type="password" class="form-control" id="pass" name="password" placeholder="Change-Password">
        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
        <button type="submit" class="btn btn-info">OK</button>
          <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
            </form>
        </div>
        
      </div>
    </div>
  </div>
    <!--  -->
    <script>
        $(document).ready(function(){
            $("#passtext").hide();
            //alert('hai');
        $("#showpass").click(function(){
        if($(this).is(":checked")){
            $("#passtext").show();
            $("#pass").hide();
        }
        else
        {
            $("#passtext").hide();
            $("#pass").show();
        }
        });
        });
    </script>
    <script>
        $(document).ready(function(){
           
            //alert('hai');
        $("#pass").keyup(function(){
            var a =$(this).val();
            //alert(a);
        $("#passtext").val(a);
        });
        });
    </script>
    <script>
        $(document).ready(function(){
            
            //alert('hai');
            $("#passtext").keyup(function(){
            var a =$(this).val();
           // alert(a);
        $("#pass").val(a);
        });
        });
    </script>
    </body>
</html>