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/ellexsleevesapartments.com/public_html/ |
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']);
$page_title = "Forgot Password?";
$page_header = "df4d5a9879.jpg";
include("header.php"); ?>
<title><?php echo $company_name; ?> - <?php echo $page_title; ?></title>
<?php include("page_header.php"); ?>
<?php $emailexsit_Error=""; $errors=0;$date = date("Y-m-d");$msg="";
if (isset($_POST['recover_password'])) {
$email = mysqli_real_escape_string($con,$_POST['email']);
$sql = "SELECT first_name,last_name FROM users WHERE email = '$email' LIMIT 1" ;
$check_query = mysqli_query($con,$sql);
$count_email = mysqli_num_rows($check_query);
if($count_email !== 1){
$_SESSION["action"] = "true";
$message="No account is associated with $email";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=$page_name&m=$message\">";exit();
$errors = 1;
}
else{
$get = mysqli_fetch_array($check_query);
$first_name = $get["first_name"];
$last_name = $get["last_name"];
}
if($errors == 0 AND isset($_POST['recover_password'])){
$security_code = substr(md5(rand()), 0, 26);
$query = mysqli_query($con,"INSERT INTO password_recovery VALUES(
'0',
'$email',
'$security_code',
'$date',
'no'
)")or die(mysqli_error($con));
//
$msg = '';
$subject = "$company_name Password Recovery";
$message = "Hello $first_name $last_name,<br/><br/>
You are receiving this email beacuse you requested for a password reset.<br/>
To get started click <a href='$link/passwordrecovery.php?u=$security_code'>here</a><br/>
If you have any enquires please feel free to get in touch at $company_email<br/><br/>
Regards,<br/>
The $company_name Team<br/>
$email_logo
";
date_default_timezone_set('Africa/Lagos');
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email";
$mail->Password = "$no_reply_password";
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("$message");
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
//$mail->AddAttachment(""); // attachment
if(!$mail->Send()) {
$_SESSION["action"] = "true";
$message="Please try again later";
echo "<meta http-equiv=\"refresh\" content=\"0; url=failure.php?u=$page_name&m=$message\">";exit();
$errors = 1;
}
else {
$_SESSION["action"] = "true";
$message="A email with a reset link has been sent to $email";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";exit();
}
}
}
?>
<section class="gallery-one gallery-one--page">
<div class="container">
<div class="row">
<div class="col-lg-12 wow fadeIn" data-wow-delay="0.1s">
<div class="section-title">
<h3 class="title mb-4">Reset Your Password</h3>
<p>Fill in your email and a link to reset it will be sent to you.</p>
</div>
<span style='color:black;font-weight:900;'><?php echo $msg; ?></span>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<div class="row">
<div class=" col-md-6">
<input type="email" name='email' class="form-control mb-2" placeholder='Email' required>
</div>
<div class="col-md-12">
<button type='submit' class="btn btn-primary" name='recover_password' >Send</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
<?php include("footer.php"); ?>