????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................<?php
   include('session.php');
include 'connection.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $current_password = $_POST['current_password'];
    $new_password = $_POST['new_password'];
    $confirm_password = $_POST['confirm_password'];
    $userid = $_SESSION['uid'];

    // Verify current password
    $sql = "SELECT * FROM users WHERE userid = ? AND pass = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("ss", $userid, $current_password);
    $stmt->execute();
    $result = $stmt->get_result();

    if ($result->num_rows === 1) {
        if ($new_password === $confirm_password) {
            // Update password
            $update_sql = "UPDATE users SET pass = ? WHERE userid = ?";
            $stmt = $conn->prepare($update_sql);
            $stmt->bind_param("ss", $new_password, $userid);
            
            if ($stmt->execute()) {
                echo "<script>alert('Password updated successfully!'); window.location.href='home.php';</script>";
                exit();
            } else {
                $error = "Failed to update password";
            }
        } else {
            $error = "New passwords do not match";
        }
    } else {
        $error = "Current password is incorrect";
    }
}
   
    
  //-------------------------------------------------


?>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Invoice | Xcel Training Institute</title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" href="../images/favicon.png">
    <!-- Base Styling  -->
    <link rel="stylesheet" href="assets/main/css/fonts.css">
    <link rel="stylesheet" href="assets/main/css/style.css">

        <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>

     


    <style>
        .btn {
            background-color: red;
            border: none;
            color: white;
            padding: 5px 5px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 20px;
            margin: 4px 2px;
            cursor: pointer;
            border-radius: 20px;
        }

        .green {
            background-color: #199319;
        }

        .red {
            background-color: red;
        }


          #customer-suggestions {
            list-style: none;
            padding: 0;
            margin: 0;
            position: absolute;
            background: #f5f5f5;
            border: 1px solid #ccc;
            display: none;
            z-index: 1000;
            width:29.6%;
        }
        #customer-suggestions li {
            padding: 5px;
            cursor: pointer;
        }
        #customer-suggestions li:hover {
            background-color: #f0f0f0;
        }

    </style>
</head>

<body>


    <div id="main-wrapper" class="show">


      <?php
         include "sidebar.php";
         ?>


         <?php
         include "header.php";
         ?>


        <!-- start section content -->
        <div class="content-body">
            
        <div class="container-fluid">
            <div class="row justify-content-center">
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h4 class="card-title">Reset Password</h4>
                        </div>
                        <div class="card-body">
                            <?php if (isset($error)): ?>
                                <div class="alert alert-danger"><?php echo $error; ?></div>
                            <?php endif; ?>

                            <form method="POST" action="" class="needs-validation" novalidate>
                                <div class="form-group mb-3">
                                    <label>Current Password</label>
                                    <input type="password" class="form-control" name="current_password" required>
                                    <div class="invalid-feedback">Please enter current password</div>
                                </div>

                                <div class="form-group mb-3">
                                    <label>New Password</label>
                                    <input type="password" class="form-control" name="new_password" required>
                                    <div class="invalid-feedback">Please enter new password</div>
                                </div>

                                <div class="form-group mb-3">
                                    <label>Confirm New Password</label>
                                    <input type="password" class="form-control" name="confirm_password" required>
                                    <div class="invalid-feedback">Please confirm new password</div>
                                </div>

                                <button type="submit" class="btn btn-primary">Update Password</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div>
        <!-- End section content -->


        <?php
   include('footer.php');
?>


    </div>
    

    

    <!-- popper js -->
    <script src="assets/plugins/popper/popper.min.js"></script>

    <!-- Bootstrap -->
    <script src="assets/plugins/bootstrap/js/bootstrap.js"></script>

    <!-- Moment -->
    <script src="assets/plugins/moment/moment.min.js"></script>

    <!-- Date Range Picker -->
    <script src="assets/plugins/daterangepicker/daterangepicker.min.js"></script>

    <!-- Datatable -->
    <script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="assets/js/init-tdatatable.js"></script>

    <!-- Chart js -->
    <script src="assets/plugins/chart/chart/Chart.min.js"></script>
    <script src="assets/js/charts-custom.js"></script>

    <!-- Main Custom JQuery -->
    <script src="assets/js/toggleFullScreen.js"></script>
    <script src="assets/js/main.js"></script>

</body>
</html>