<html lang="en">

<head>

    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-GQPGJ4YN30"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());

        gtag('config', 'G-GQPGJ4YN30');
    </script>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Profile</title>
    <!-- using online links -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">

    <link rel="stylesheet" href="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.min.css">

    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
     <!-- sweet alert  -->
  <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>

    <style>
        label {
            font-weight: bold;
        }
    </style>

    <!-- print div scripts starts -->
    <script type="text/javascript">
        function printContent(el) {

            var divToPrint = document.getElementById(el);

            var newWin = window.open('', 'Print-Window');

            newWin.document.open();

            newWin.document.write('<html> <link rel="stylesheet"href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"crossorigin="anonymous">');
            newWin.document.write('<style> label{font-weight: bold;}  </style>');
            newWin.document.write('<body onload="window.print()"> ');



            newWin.document.write(divToPrint.innerHTML);

            newWin.document.write('</body></html>');

            newWin.document.close();

            setTimeout(function() {
                newWin.close();
            }, 1000);
        }
    </script>
    <!-- print div script ends -->
</head>






<body>
<?php
session_start();
if (!isset($_SESSION['MEM_ID'])) {
    header("location: index.php");
}
?>

<?php
$capchaval = substr(str_shuffle("1234abcdefghijkmnpqrABCDEFGHIJKL123456789stvwxyzMNPQRSTVWXYZ56789"), 0, 8);
include "fetch_data.php";
include "connection.php";





$MEM_ID = $_SESSION['MEM_ID'];

// $sql = "SELECT * FROM NAA_MEMBERS WHERE MEM_ID = '$MEM_ID'";
$sql = "SELECT fngetpass(PASSWORD) as PASSWORD,MEM_ID from NAA_MEMBERS
where MEM_ID = '$MEM_ID'";
$parse = ociparse($conn, $sql);
oci_execute($parse);

// print_r($sql);
while ($row = oci_fetch_assoc($parse)) {
    $user_row[] = $row;
}

// var_dump($division);
// echo count($division);
oci_free_statement($parse);


$PASSWORD = $user_row[0]['PASSWORD'];
// echo "$PASSWORD";


















if (isset($_POST['submit'])) {


    $old_password = $_POST['old_password'];
    $new_password = $_POST['new_password'];
    $confirm_new_password = $_POST['confirm_new_password'];


    if ($old_password != $PASSWORD) {
            echo '<script>
                Swal.fire({
                    icon: "error",
                    text: "You entered an incorrect password",
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "OK"
                    }).then((result) => {
                    if (result.isConfirmed) {
                        window.location.href = "change_password.php";
                    }
                    })


            </script>';
    } else if ($new_password == $confirm_new_password) {
        $sql_up = "UPDATE NAA_MEMBERS  SET PASSWORD = '$new_password' WHERE  MEM_ID = '$MEM_ID' ";


        // print_r($sql_up);
        // var_dump($sql);
        $parseresult = ociparse($conn, $sql_up);
        // var_dump($parseresult);
        // ociexecute($parseresult);
        if (ociexecute($parseresult)) {
            // echo '<script>
            //     // alert("Registration Already Done Using This Mobile Number.");
            //     Swal.fire({
            //         text: "Congratulations You have successfully changed your password",
            //         confirmButtonColor: "#3085d6",
            //         cancelButtonColor: "#d33",
            //         confirmButtonText: "OK"
            //         }).then((result) => {
            //         if (result.isConfirmed) {
            //             window.location.href = "http://localhost/ndc_alumni_2024/change_password.php";
            //             // window.location.href = "https://ndc75register.net/profile-update/index.php";
            //         }
            //         })


            // </script>';

            echo '<script>
                Swal.fire({
                    icon: "success",
                    text: "Congratulations You have successfully changed your password",
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "OK"
                    }).then((result) => {
                    if (result.isConfirmed) {
                        window.location.href = "change_password.php";
                    }
                    })


            </script>';
        } 
    } else {

        echo '<script>
        // alert("Passwords do not match")
                Swal.fire({
                    icon: "error",
                    text: "New Password & Confirm New Password do not match",
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "OK"
                    }).then((result) => {
                    if (result.isConfirmed) {
                        window.location.href = "change_password.php";
                    }
                    })


            </script>';
    }

}


?>

    <!-- dashboard start -->
    <?php include 'dashboard.php'; ?>
    <!-- dashboard end -->

<style>
    .header img {
         float: left;
         width: 100px;
         height: 100px;
         /* background: #555; */
      }

      .header h1,
      h3,
      h4,
      h5,
      h6 {
         position: relative;
         top: 18px;
         left: 10px;
      }
          #personal::placeholder {
    color: white; /* Placeholder text color white */
    opacity: 1; /* Full visibility */
    font-weight: bold;
    text-align: center;
}

</style>




    <div class="container" id="print_doc">
        <div class="card">
            <div class="card-body" style="margin:0; padding:0;">
            <div class="row">
               <div class="col-md-2"></div>
               <div class="col-md-10">
                  <div class="header">
                     <img src="assets/img/Holy_cross.png" style="border: 3px solid black;" class="mr-5 " alt="BD Logo">
                             <h3 style="color: #ddbe4d; font-style: oblique;">
                                75<sup style="font-size: 0.6em; vertical-align: super;">th</sup> Foundation Of Holy Cross Girls High School
                               </h3>
                     
                  </div>
               </div>
               <div class="col-md-2"></div>
            </div>

                <hr>



                                 <div class="row m-3">
                                   <div class="col-md-12" >
                                   
                                    <div class="col-md-12">
                                        <input type="text" class="form-control" name="personal" id="personal" placeholder="Password changed Form" value="" disabled="" style="background-color: #ddbe4d; color: white;">
                                    </div>
                                   
                                </div>
                                 </div>



                <div class="form-body">
                    <form action="" onsubmit="return myfun()" method="POST" enctype="multipart/form-data">
                        <div class="row m-3" style="padding-top: 20px;">
                            <div class="col-lg-6 col-md-6 col-sm-12">
                                <div class="row ">
                                    <div class="col-lg-4 col-md-4 col-sm-12">
                                        <label for="text" class="text-center font-weight-bold" style="color: black;margin-left: 20px">Old Password:</label>
                                    </div>
                                    <div class="col-lg-8 col-md-8 col-sm-12">
                                        <input type="password" class="form-control" name="old_password" id="old_password" placeholder="Enter Old Password" value="" style="border: 2px solid #ddbe4d; ">
                                    </div>
                                </div>
                            </div>


                            <div class="col-lg-6 col-md-6 col-sm-12">
                                <div class="row ">
                                    <div class="col-lg-4 col-md-4 col-sm-12">
                                        <label for="text" class="text-center font-weight-bold" style="color: black"> New Password:</label>
                                    </div>
                                    <div class="col-lg-8 col-md-8 col-sm-12">
                                        <input type="password" class="form-control" name="new_password" id="new_password" placeholder="Enter New Password" value="" style="border: 2px solid #ddbe4d; ">
                                    </div>
                                </div>
                            </div>




                        </div>






                </div>





                <div class="row m-3">
                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-12">
                                <label for="text" class="text-center font-weight-bold" style="color: black">Confirm New Password:</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-12">
                                <input type="password" class="form-control" name="confirm_new_password" id="confirm_new_password" placeholder="Enter Confirm New Password" value="" style="border: 2px solid #ddbe4d; ">
                            </div>
                        </div>


                    </div>





                </div>







            </div>















            <div class="row m-3">













                <div class="col text-center">
                    <button type="submit" class="btn btn-success m-3" name='submit' id='submit'>
                        Submit
                    </button>
                </div>
            </div>


            </form>

        </div>
    </div>
    </div>






































    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
    <script src="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>





</body>

</html>