Files
4WDCSA.co.za/reset_password.php
twotalesanimation 110c853945 Refactor: Update all remaining pages to use unified header template
- Updated 39 pages from old header01.php and header02.php includes
- All pages now use single configurable header.php with $headerStyle variable
- Light style (default): Most pages (login, register, trips, courses, etc.)
- Dark style: Coming from header01 original usage

Pages updated:
  - Admin pages: admin_*.php (10 files)
  - Booking pages: bookings.php, campsite_booking.php, etc.
  - Content pages: blog.php, blog_details.php, contact.php, events.php, etc.
  - User pages: account_settings.php, membership*.php, register.php, etc.
  - Utility pages: 404.php, payment_confirmation.php, reset_password.php, etc.

All pages now maintain single header template source - easier to update navigation, styles, and functionality across the entire site.
2025-12-03 16:55:32 +02:00

113 lines
4.5 KiB
PHP

<?php
$headerStyle = 'light';
include_once('header.php');
$token = $_GET['token'] ?? '';
if (empty($token)) {
die("Invalid token.");
}
// Verify the token
$sql = "SELECT user_id FROM password_resets WHERE token = ? AND expires_at > NOW()";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $token);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows === 0) {
die("Token is invalid or expired.");
}
$user = $result->fetch_assoc();
$user_id = $user['user_id'];
// Display the reset password form
?>
<style>
@media (min-width: 991px) {
.container {
max-width: 720px;
padding: 0 15px; /* Ensure padding doesn't cause overflow */
}
</style>
<!-- Contact Form Area start -->
<section class="contact-form-area py-120 rel z-1">
<div class="container">
<div class="row align-items-center">
<div class="">
<div class="comment-form bgc-lighter z-1 rel mb-30 rmb-55">
<form id="changePasswordForm" class="loginForm" name="changePasswordForm" action="update_password.php" method="post" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">
<div class="section-title">
<h2>Reset Password</h2>
<div class="pt-20" style="text-align: center;" id="responseMessage"></div> <!-- Message display area -->
</div>
<div class="row mt-35">
<div class="col-md-12">
<div class="form-group">
<label for="new_password">New Password</label>
<input type="password" id="new_password" name="new_password" class="form-control" placeholder="Enter password" value="" required data-error="Please enter your password">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="confirm_password">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control" placeholder="Confirm password" value="" required data-error="Please confirm your password">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group mb-0">
<input type="hidden" name="token" value="<?php echo htmlspecialchars($token); ?>">
<button type="submit" class="theme-btn style-two" style="width:100%;">Reset Password</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Form Area end -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
// Change Password
$('#changePasswordForm').on('submit', function(event) {
event.preventDefault(); // Prevent default form submission
$.ajax({
url: 'update_password.php',
type: 'POST',
data: $(this).serialize(),
success: function(response) {
// Parse response if needed
if (typeof response === "string") {
response = JSON.parse(response);
}
if (response.status === 'success') {
$('#responseMessage').html('<div class="alert alert-success">' + response.message + '</div>');
} else {
$('#responseMessage').html('<div class="alert alert-danger">' + response.message + '</div>');
}
},
error: function() {
$('#responseMessage2').html('<div class="alert alert-danger">Error changing password.</div>');
}
});
});
});
</script>
<?php include_once("insta_footer.php"); ?>