Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/adesmiley.com/public_html/admin41345/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<title><?php echo $company_name; ?>, Admin, Change Password</title>
<?php
if (isset($_POST['change_password'])) {
$old_password = mysqli_real_escape_string($con,$_POST['old_password']);
$new_password = mysqli_real_escape_string($con,$_POST['new_password']);
$stmt = $con -> prepare('SELECT * FROM admin WHERE username=?');
$stmt -> bind_param('s',$manager);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$username,$password_from_db);
$numrows = $stmt -> num_rows();
while ($stmt -> fetch()) { }
if ($password_from_db !== $old_password){
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Wrong Password.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=$page_name&m=$message\">";
}
if ($password_from_db == $old_password){
$stmt = $con -> prepare('UPDATE admin SET password=? WHERE username = ?');
$stmt -> bind_param('ss',$new_password,$manager);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Password successfully changed.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container"> </div>
</section>
<!-- End Breadcrumbs -->
<section id="contact" class="contact inner-page">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2>Password</h2>
<p>Change your password</p>
</div>
<div class="row">
<div class="col-lg-6 mt-5 mt-lg-0 d-flex align-items-stretch">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
<div class="form-row">
<div class="form-group col-md-6">
<input type="password" name="old_password" class="form-control" placeholder="Old Password" required />
</div>
<div class="form-group col-md-6">
<input type="password" name="new_password" class="form-control" placeholder="New Password" required />
</div>
</div>
<div class="text-center">
<button type="submit" name='change_password'>Save</button>
</div>
</form>
</div>
<div class="col-md-6 col-lg-3 mb-4 mb-lg-0">
</div>
</div>
<br/><br/>
</div>
</section>
<?php include("footer.php"); ?>