<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');
$user = $_SESSION["username_bmexp"];

if(isset($_POST["save"])){
 $pwd  = $_POST["pwd1"];
 $pwd2 = $_POST["pwd2"];
 
  if($pwd ==  $pwd2){
      mysqli_query($conn, "UPDATE `usermain` SET password='$pwd' WHERE `username`='$user'") or die(mysqli_error($conn));
      browse("PASSWORD CHANGED SUCESSFULLY");
  }       
    
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
    
    <head>
        <meta charset="UTF-8">
        <title>Change Password</title>
        <meta name="msapplication-TileColor" content="#5bc0de"/>
        <meta name="msapplication-TileImage" content="assets/img/metis-tile.png"/>
        
        <link rel="stylesheet" href="assets/lib/bootstrap/css/bootstrap.css">
        <link rel="stylesheet" href="assets/css/main.css"/>
        <link rel="stylesheet" href="assets/lib/Font-Awesome/css/font-awesome.css"/>

        <link rel="stylesheet" href="assets/css/theme.css">

        
        <link rel="stylesheet" href="assets/lib/uniform/themes/default/css/uniform.default.css">
        <link rel="stylesheet" href="assets/lib/inputlimiter/jquery.inputlimiter.1.0.css">
        <link rel="stylesheet" href="assets/lib/chosen/chosen.min.css">
        <link rel="stylesheet" href="assets/lib/colorpicker/css/colorpicker.css">
        <link rel="stylesheet" href="assets/lib/tagsinput/jquery.tagsinput.css">
        <link rel="stylesheet" href="assets/lib/daterangepicker/daterangepicker-bs3.css">
        <link rel="stylesheet" href="assets/lib/datepicker/css/datepicker.css">
        <link rel="stylesheet" href="assets/lib/timepicker/css/bootstrap-timepicker.min.css">
        <link rel="stylesheet" href="assets/lib/switch/static/stylesheets/bootstrap-switch.css">
        <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/flick/jquery-ui.css">
        
        
        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

            ga('create', 'UA-1669764-16', 'onokumus.com');
            ga('send', 'pageview');

        </script>

        <script src="assets/lib/modernizr-build.min.js"></script>
        <script type="text/javascript" src="js/jquery.js"></script>
	
	<!--[if lt IE 9]>
	    	<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
	    	<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
function checkPasswordMatch() {
    var password = $("#pwd1").val();
    var confirmPassword = $("#pwd2").val();



    if (password != confirmPassword)
        $("#status").html('<font color="red"><strong>Passwords Does Not Match'),
        $("#save").attr("disabled", "disabled");    
    else
        $("#status").html('<font color="green"><strong>Passwords Match'),
        $("#save").removeAttr("disabled");    
        
}
</script>
<style>
.check-with-label:checked + .label-for-check {
  color: #228B22;
}
.check-with-label2:checked + .label-for-check2 {
  color: #228B22;
}


</style>

</head>
    <body onLoad="document.boq.vouchdt.focus();">
        <form action=''  name="customer" method="POST">
<div class="row">
<div class="col-lg-6" style='width:50%;float:center;'>
    <div class="box dark">
        <header>
            <div class="icons"><i class="fa fa-edit"></i></div>
            <h5>Change Password</h5>
            <!-- .toolbar -->
            <div class="toolbar">
                <ul class="nav">
                    <li><input type='submit' name='submit' id='save' value='Save' class="btn btn-primary"></li>
                    <li>
                        <a class="accordion-toggle minimize-box" data-toggle="collapse" href="#div-1">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </li>
                </ul>
            </div>
            <!-- /.toolbar -->
        </header>
        <div id="div-1" class="accordion-body collapse in body">
            <div class="form-horizontal">
              <input type="hidden" size="6" maxlength="6" id="mvouch" maxlength="6" name="mvouch" value="<?php echo ($addflag == 0) ? $get['vouchno'] : $qvouch; ?>" />      
              <div class="form-group">
                <label class="control-label col-lg-4">User Name </label>
                   <div class="col-lg-8"> 
                   <input type="text" size="40" name="user" value="<?php echo $user;?>"  class="form-control" disabled />
                      
                   </div> 
              </div> 
              <div class="form-group">
                <label class="control-label col-lg-4">Password</label>
                   <div class="col-lg-8"> 
                          <input id="pwd1" type="password" size="40" name="pwd1" class="form-control"  required/>
                    </div>
               </div>
              <div class="form-group">
                <label class="control-label col-lg-4">Confirm Password</label>
                   <div class="col-lg-8"> 
                          
                          <input id="pwd2" type="password" size="40" name="pwd2" class="form-control" onkeyup="checkPasswordMatch();" required/><div id="status"></div>
                    </div>
               </div>
 </div>
 </div>
 </div>



                
	</form>

</body>
</html>
