<div class="modal fade js-modal-settings modal-backdrop-transparent" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-right modal-md">
            <div class="modal-content">
                <div class="dropdown-header bg-trans-gradient d-flex justify-content-center align-items-center w-100">
                    <h4 class="m-0 text-center color-white">
                        Change Password
                        <small class="mb-0 opacity-80">User Interface Settings</small>
                    </h4>
                    <button type="button" class="close text-white position-absolute pos-top pos-right p-2 m-1 mr-2" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                    </button>
                </div>
                <div class="modal-body p-0">
                    <div class="settings-panel">
                        <form action="" method="POST" class="form" role="form" autocomplete="off">
                            <div class="form-group">
                                <label for="password">New Password</label>
                                <input type="hidden" name="usPwd" value="<?php echo $acc_id;?>">
                                <input type="password" class="form-control" id="password" name="newPwd" required="" placeholder="*****">
                                <span class="form-text small text-muted" id="msg"></span>
                            </div>
                            <div class="form-group">
                                <label for="confirm_password">Confirm</label>
                                <input type="password" class="form-control" id="confirm_password" name="confyPass" required="" placeholder="*****">
                                <span class="form-text small text-muted" id='message'></span> 
                            </div>
                            

                        <hr class="mb-0 mt-4">
                        <div class="pl-5 pr-3 py-3 bg-faded">
                            <div class="row no-gutters">
                                <div class="col-6 pr-1">
                                  <button type="submit" class="btn btn-success btn-md float-right" id="pwdSv">Save Changes</button>
                                </div>
                            </div>
                        </div>

                        </form>   

                        <?php 
                        if(!empty($_REQUEST['usPwd'])){
                        $dir = ['cost' => 12];
                        $NewPass = $_REQUEST['newPwd'];
                        $MyPwd = password_hash($NewPass, PASSWORD_DEFAULT, $dir);
        
                        $quePwd = $db->prepare("update tbl_user_access set password=? WHERE last_acc=?");
                        try {
                            // time logged
                            $quePwd->execute(array($MyPwd, $_REQUEST['usPwd']));
                            } catch (PDOException $ex) {
                            //Something went wrong rollback!
                            echo $ex->getMessage();
                            } 
                        $message=1;
                            
                        if(!empty($message)){
                                echo'<script type="text/javascript">
                                jQuery(function validation(){
                                swal("Success", "Password changed!", "success", {
                                button: "Continue",
                                    });
                                });
                                </script>';
                                }
                        
                            echo'<meta http-equiv="refresh"'.'content="2;URL=../login">';       
                        }
                        ?>
                    </div> <span id="saving"></span>
                </div>
            </div>
        </div>
    </div>