MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/imyrqtmy/public_html/eventsbyshubhchintak/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/eventsbyshubhchintak/change-password.php
<?php include'includes/db-conn.inc.php';
if(!isset($_SESSION['customer_id'])){
echo "<script>window.location = 'index.php';</script>";
}
$userid=$_SESSION['customer_id'];
$sqluser=mysqli_query($conn,"select * from tbl_user where userid='$userid' and status='1'")or die(mysqli_error());
$rowuser=mysqli_fetch_assoc($sqluser);
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Libs -->
<link rel="stylesheet" href="assets/libs/bootstrap-icons/font/bootstrap-icons.css">
<link rel="stylesheet" href="assets/fonts/wedding-icon-font/flaticon.css">
<link rel="stylesheet" href="assets/fonts/fontello/css/fontello.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.21/dist/sweetalert2.all.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.21/dist/sweetalert2.min.css" rel="stylesheet">
<!-- Theme CSS -->
<link rel="stylesheet" href="assets/css/theme.min.css">
  <title>Change Password | Wedding & Event by Shubhchintak</title>
</head>

<body>
<?php include 'includes/navbar.php'; ?>
  <!-- sign up -->
      <main>
      <section class="pt-6 pb-4">
      <div class="container">
         <div class="row">
            <div class="col-lg-12 col-md-12 col-12">
               <div>
                  <small style="color: #6b7280 !important;"><a href="index.php">Home </a> > <a href="dashboard.php">Dashboard</a> > Change Password</small><br>
                  <h4 class="display-5 fw-semi-bold mb-0" style="font-size: 24px;margin-top: 13px;">Shubhchintak's User Dashboard</h4>
                   <small>Access Your Dashboard Here</small>
               </div>
            </div>
         </div>
      </div>
   </section>
        <section class="py-6 bg-light">
            <div class="container">
                <div class="row">
                  <div class="col-md-4 mt-6 mt-md-0">
                        <div class="card">
                            <div class="card-body">
                                <div class="mb-4">
                                    <div class="mb-3">
                                        <h3>Welcome <?php echo $rowuser['name']; ?> !</h3>
                                    </div>
                                </div>
              
                                <div class="d-grid">
                                    <a href="dashboard.php" class="btn btn-sm btnside">Dashboard</a>
                                </div><br>
                                <div class="d-grid">
                                    <a href="shortlist.php" class="btn btn-sm btnside">My Shortlist</a>
                                </div><br>
                                <div class="d-grid">
                                    <a href="change-password.php" class="btn btn-sm btnactive active">Change Password</a>
                                </div><br>
                                <div class="d-grid">
                                    <a href="logout.php" class="btn btn-sm btnside">Logout</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-8">
                        <div class="card mb-4">
                            <div class="row g-0">
                                <div class="col-xxl-12 col-lg-12">
                                    <div class="position-relative">
                                        <div class="mb-4">
                                            <div class="mb-3">
                                                <h3 style="padding: 21px;">Change Password <span id="error" style="font-size: 12px;"></span></h3>
                                              
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!-- Change password -->
                                <div class="container">
                                    <form method="post" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="mb-3">
                                        <input type="password" class="form-control" placeholder="Old Password" aria-label="password" name="txtoldpassword" required>
                                        <input type="hidden" value="<?php echo $rowuser['userid']; ?>" name="txtuserid" required>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="mb-3">
                                        <input type="password" class="form-control" placeholder="New Password" aria-label="Phone" required name="txtpassword">
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <button class="btn btn-primary btn-md" type="submit" name="changepassword" style="    width: 100%;"> Change Password</button>
                                </div>
                            </div>
                        </form>
                                 </div>
                                <!-- change password close -->
                            </div><br>
                        </div>
                    </div>
                    
                </div>
            </div>
        </section>
    </main>
    <!-- scripts -->
  <?php include 'includes/footer.php'; ?>
<script src="assets/libs/jquery/dist/jquery.min.js"></script>
<script src="assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/libs/flatpickr/dist/flatpickr.min.js"></script>
<!-- Theme JS -->
<script src="assets/js/theme.min.js"></script>
</body>
</html>
<?php 

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

   $user_id=$_POST['txtuserid'];
   $oldpassword =md5( $_REQUEST['txtoldpassword']);
   $newpassword =md5( $_REQUEST['txtpassword']);

   $sql="select * from tbl_user where password='$oldpassword' and userid='$user_id'";
   $run=mysqli_query($conn,$sql) or die(mysqli_error($conn));
   $row=mysqli_num_rows($run);

    if($row==1)
   {  
      // echo "<script> alert('Password Matched');</script>";
       $sql1="update tbl_user set password='$newpassword' where userid='$user_id'";

        if(mysqli_query($conn,$sql1) or die (mysqli_error($conn)))
        {
          ?>  
           <script>
            Swal.fire(
                 'Success !',
                 'Password Update Successfully.',
                 'success'
                 )
           </script> <?php 
        }
        else
        {
          ?>  
               <script>
                Swal.fire(
                     'Sorry !',
                     'Something went wrong ! please Try again',
                     'error'
                     )
               </script> <?php 
        }

   }
  else
  {
    echo "<script>
    $('#error').html('*Old Password not Matched !').css('color', 'red');
    </script>";
  }

}
?>

MMCT - 2023