%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_93b53270/ |
Upload File : |
<?php include('header.php');
$date=date('Y-m-d');
$sqli_check = mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE update_date='$date' AND type = 'User' AND token = '1' AND status=1 AND email='".$_SESSION['email']."'");
if (!isset($_SESSION['email'])) {
echo "<script>window.location='".$base_url."forgot-password.php'</script>";
}elseif(mysqli_num_rows($sqli_check) < 0){
echo "<script>window.location='".$base_url."forgot-password.php'</script>";
}
?>
<style type="text/css">
.eye-icon {
float: right;
margin-right: 10px;
margin-top: -30px;
position: relative;
z-index: 99999;
}
</style>
<section id="login">
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="bg-grey m-5">
<?php if(isset($_SESSION['message'])): ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark"><?php echo $_SESSION['message']; ?> <i class="feather icon-thumbs-up text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php unset($_SESSION['message']); ?>
<?php endif; ?>
<?php if(isset($_SESSION['error'])): ?>
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong class="text-danger"><?php echo $_SESSION['error']; ?> <i class="feather icon-thumbs-up text-dark"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php unset($_SESSION['error']); ?>
<?php endif; ?>
<form class="form-control p-4" method="POST" action="">
<h2 class="text-center text-danger mb-3">Generate New Password</h2>
<label>New Password</label>
<input id="password-field" type="password" name="password" class="form-control" required>
<span toggle="#password-field" class="ri-eye-off-line eye-icon" id="togglePassword"></span>
<label>Confirm Password</label>
<input id="password-confirm" type="cpassword" name="cpassword" class="form-control" required>
<span toggle="#password-confirm" class="ri-eye-off-line eye-icon" id="togglePassword_confrim"></span>
<button type="submit" name="generate" class="btn-theme w-100 nextBtn mt-2">Submit</button>
</form>
</div>
</div>
</div>
</div>
</section>
<?php include('footer.php'); ?>
<script type="text/javascript">
$("#togglePassword, #togglePassword_confrim").click(function() {
$(this).toggleClass("ri-eye-off-line ri-eye-line");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
</script>
<?php
if(isset($_POST['generate'])){
$password = mysqli_real_escape_string($conn,$_POST['password']);
$cpassword = mysqli_real_escape_string($conn,$_POST['cpassword']);
$date = date('Y-m-d');
// Password match validation
if ($password != $cpassword) {
$_SESSION['error'] = "Passwords don't match! Try again.";
echo "<script>window.location='generate_new_password.php';</script>";
exit;
}else{
$sql = mysqli_query($conn,"UPDATE `user_tbl` SET
`password`='$cpassword',
`token`='',
`OTP`='' WHERE email='".$_SESSION['email']."'");
if($sql){
unset($_SESSION['email']);
echo "<script>window.location='login.php';</script>";
$_SESSION['message'] = "Update successfully.";
exit;
} else {
echo "<script>window.location='generate_new_password.php';</script>";
$_SESSION['error'] = "Something went wrong! Sorry.";
exit;
}
}
}
?>