<?php
session_start();

if($_SESSION['name']==''){
    header("Location:index.php");die();
}

?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
  <!-- Morris chart -->
  <link rel="stylesheet" href="bower_components/morris.js/morris.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="bower_components/jvectormap/jquery-jvectormap.css">
  <!-- Date Picker -->
  <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  <!-- Daterange picker -->
  <link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">
  <!-- bootstrap wysihtml5 - text editor -->
  <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet" href="bower_components/datatables/css/dataTables.bootstrap.min.css">
  <link rel="stylesheet" href="bower_components/datatables/css/dataTables.bootstrap.css">
  
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="bower_components/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->

<!-- Bootstrap 3.3.7 -->
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Morris.js charts -->

<!-- Sparkline -->
 <script src="vendor/datatables/jquery.dataTables.js"></script>
    <script src="vendor/datatables/dataTables.bootstrap4.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<!--<script src="dist/js/pages/dashboard.js"></script>-->
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <?php include("header.php");?>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <?php include("sidebar.php");?>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
  

    <!-- Main content -->
    <section class="content">
      
        <div class="row">
            <div class="col-md-12">
          <!-- Custom Tabs -->
          <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
<!--                 <li class=""><a href="#tab_11" data-toggle="tab">Invoice</a></li>-->
<!--              <li><a href="#tab_21" data-toggle="tab">View Hotel</a></li>-->
              <li class="active rm"><a href="#tab_11" data-toggle="tab">Update Password</a></li>
            
            
             
             
            </ul>
            <div class="tab-content ">
                <div class="tab-pane active" id="tab_11">
                    <div id='div1'>
                    Current Password:<br><input type='password' class='' id='current_pwd'>
                 <br><br>
                     <button class='btn btn-primary' id="verify_pwd">Verify</button>
                    </div>   
                    
                     
              </div>
               <div class="tab-pane" id="tab_21">
                 
              </div>
                
           
            
              <!-- /.tab-pane -->
              <div class="tab-pane" id="tab_2">
                 
              </div>
              <!-- /.tab-pane -->
              <div class="tab-pane" id="tab_3">
               
              </div>
              <!-- /.tab-pane -->
            </div>
            <!-- /.tab-content -->
          </div>
          <!-- nav-tabs-custom -->
        </div>
            
            
        </div>
        
        
        
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
 
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->

</body>
</html>
<style>
    .required:before{
   color: red;
   content: "*";
   position: absolute;
font-weight:bold !important;font-size: 18px;
}
    
    
</style>
<script src="jquery-ui.js"></script>
<link href='jquery-ui.css' rel='stylesheet'>
<script src='notify.min.js'></script>
<script src='notify.js'></script>
<link href='chosen.css' rel='stylesheet'>
<script>
    $("#from_date").datepicker({ dateFormat: "yy-mm-dd"}).datepicker("setDate", "0");
    $("#to_date").datepicker({ dateFormat: "yy-mm-dd"}).datepicker("setDate", "0");
    
    function notify(data){
$.notify(data, "success");
    }
     function notify1(data){
$.notify(data, "error");
    }
    $("#verify_pwd").click(function(){
        pwd=$("#current_pwd").val();
         $.ajax({
          url: "verify_pwd.php",
          type:"POST",
          dataType: "json",
          data: {
            pwd:pwd
          },
          success: function( data ) {
              if(data==1){
              var html="New Password:<br><input type='password' id='new_pwd'><br>"
              +"Confirm Password:<br><input type='password' id='new_pwd_cur'><br><br>"
      +"<button class='btn btn-primary' id='update_pwd'>Update</button>";
      $("#div1").html(html);
  } 
           
          },error:function(xhr){
              notify1(xhr.responseText);
          }
        });
    });
    
   $("body").on("click","#update_pwd",function(){
       var pwd=$("#new_pwd").val();
        var new_pwd_cur=$("#new_pwd_cur").val();
        if(pwd==""||new_pwd_cur==""){
            notify1("all fields are mandatory");return;
        }
         $.ajax({
          url: "update_pwd.php",
          type:"POST",
          dataType: "json",
          data: {
            pwd:pwd,new_pwd:new_pwd_cur
          },
          success: function( data ) {
              notify(data+" Row Updated Successfully");
          },error:function(xhr){
              notify1(xhr.responseText);
          }
        });
    });
    </script>