<?php include("includes/header.php"); ?>
<?php include("includes/auto_out.php"); ?>
<!DOCTYPE html>
<html>
<head>
  <title>Update Password | <?php echo $sitename; ?></title>
  
     <!----------------------------------------------------------------------->
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
     <script src="bootstrap/js/jquery.min.js"></script>
     <script src="bootstrap/js/bootstrap.min.js"></script>
     <!----------------------------------------------------------------------->
     <link rel="icon" href="images/fav-icon.ico" type="image/x-icon" />
    <!-- <link rel="shortcut icon" href="images/fav-icon.ico" type="image/x-icon" />
     <!----------------------------------------------------------------------->
     <!-------------------Constumized CSS--------------------------->
     <link rel="stylesheet" type="text/css" href="css/style.cs">

     <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
     <style>
        body{
          background-color: #f5f5f5;
        }
      .icons-links{
        text-decoration: none;
        color: #555;
        font-size: 16px;
        font-weight: bolder;
      }
      .icons-links:hover{
        color:#0c2074;
        text-decoration: none;
      }
     </style>
     
</head>
<body>
  <?php  include("includes/dashboard_nav.php"); ?>
    <br>
  <div class="container-fluid">
    

        <div class="row">
      <div class="col-sm-2">
        <?php include("includes/sidebar.php"); ?>
          <?php include("includes/side.php"); ?>
      </div>
      <div class="col-sm-10">
               <div class="row">

                   <!------------------LEFT ROW ---------------------------->
                   <div class="col-sm-5">
                       
                      
                     
                       <!------------------------------------------------------>

                       <div class="row">
                         <div class="col-sm-12">
                            <div class="panel panel-default">
                             <div class="panel-body">
                               <h4 style=""><img src="images/3257787.png" width="43">  UPDATE PASSWORD</h4>
                               <hr>

                               <div class="row">

                                <div class="col-sm-12" align="">


                                  <?php
                                    if(isset($_POST["passwordbtn"])){

                                      //GET ALL VAIRABLES
                                      $my_account = $_POST["my_account"];
                                      $old_password = $_POST["old_password"];
                                      $new_password = $_POST["new_password"];
                                      $new_password2 = $_POST["new_password2"];

                                      //Check if password is correct with db pass
                                      if($b_password == $old_password){

                                        //Check if Pin==Pin2
                                        if($new_password == $new_password2){
                                            //Update new pin
                                            $query = mysqli_query($conn, "UPDATE users SET b_password = '$new_password' WHERE id = '$u_dbid'");
                                            echo "<div class='alert alert-success'><i class='glyphicon glyphicon-ok'></i> Account Password Updated Successfully!</div>";
                                        }else{
                                            echo "<div class='alert alert-danger'><i class='glyphicon glyphicon-warning-sign'></i> New password does not match!</div>";
                                        }
                                         
                                      }else{
                                        echo "<div class='alert alert-danger'><i class='glyphicon glyphicon-warning-sign'></i> Invalid Old Account Password!</div>";
                                      }

                                    }
                                  ?>


                                  <div class="alert alert-info">Fill in the form below to update your account password.</div>



                                   <form action="" method="POST">
                                     <div class="form-group">
                                      <label>My Account:</label>
                                       <select class="form-control input-lg" name="my_account" style="border-radius: 0px;">
                                         <option><?php echo $account_number; ?> - <?php echo ucfirst($firstname)."&nbsp;".ucfirst($middlename)."&nbsp;".ucfirst($lastname) ?></option>
                                       </select>

                                       <br>


                                       <label>Old Password:</label>
                                       <input type="password" class="form-control input-lg" name="old_password" style="border-radius: 0px;" placeholder="********" autocomplete="none" required/>

                                       <br>

                                       <label>New Password:</label>
                                       <input type="password" class="form-control input-lg" name="new_password" style="border-radius: 0px;" placeholder="********" autocomplete="none" required/>

                                       <br>

                                       <label>Confirm New Password:</label>
                                       <input type="password" class="form-control input-lg" name="new_password2" style="border-radius: 0px;" placeholder="********" autocomplete="none" required/>

                                       <br>

                                       <button type="submit" name="passwordbtn" class="btn btn-primary" style="border-radius: 0px;">Update Password</button>
                                     </div>
                                   </form>
                                </div>


                                 
                               </div>

                               <br>
                               
                             </div>
                           </div>
                         </div>
                       </div>
                       <!------------------------------------------------------>
                       
                   </div>
                   <!-----------------/LEFT ROW ---------------------------->

                   <!------------------------------------------------------->

                   <!------------------RIGHT ROW --------------------------->
                   <div class="col-sm-4">

                  
                    
                   </div>
                   <!-----------------/RIGHT ROW --------------------------->
               </div>
      </div>
    </div>
  </div>
</body>
</html>