File "fpassword-20260111072316.php"
Full Path: /home/ovanhxso/public_html/panel/fpassword-20260111072316.php
File size: 6.65 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
require_once('assets/constant/config.php');
$sql = "select * from manage_web";
$statement = $conn->prepare($sql);
$statement->execute();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
extract($row);
}
?>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
?>
<?php
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
if (isset($_POST['sendmail'])) {
$otp = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 8)), 0, 8);
$text_email = $_POST['email'];
$sql = "SELECT * FROM login where email ='" . $text_email . "' ";
$statement = $conn->prepare($sql);
$statement->execute();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
extract($row);
// print_r($row);
$realemail = $row['email'];
}
$msg = "Hello , Your New Password is: " . $otp;
$subject = 'Remind password';
//$m = mail($to,$subject,$msg,$headers);
$otp1 = hash('sha256', $otp);
function createSalt()
{
return '2123293dsj2hu2nikhiljdsd';
}
$salt = createSalt();
$otp_pass = hash('sha256', $salt . $otp1);
if ($text_email == $realemail) {
$sql = "UPDATE login SET password ='$otp_pass' WHERE email='$text_email'";
$statement = $conn->prepare($sql);
$statement->execute();
$stmt = $conn->prepare("SELECT * FROM emailsetting");
$stmt->execute();
$result = $stmt->fetchAll();
foreach ($result as $row) {
$smtp_server = $row['smtp_server'];
$smtp_password = $row['smtp_password'];
$smtp_enc = $row['smtp_type'];
$smtp_username = $row['smtp_username'];
$smtp_port = $row['stmp_port'];
}
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = $smtp_server;
$mail->SMTPAuth = true;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
$mail->SMTPSecure = $smtp_enc;
$mail->Port = $smtp_port;
$mail->setFrom($smtp_username);
$mail->addAddress($text_email);
// $mail->setFrom($_POST['emailenq']);
// $mail->addAddress($smtp_username);
$mail->isHTML(true);
//$dt=date('Y-m-d');
$mail->Subject = 'Important: Reset Your Password';
$mail->Body = $msg;
$mail->AltBody = $msg;
$mail->send();
// echo '<pre>';
// print_r($mail);die;
// if($mail->send())
// {
?>
<link rel="stylesheet" href="assets/popup_style.css">
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h1>
<p>Password Sent Successfully.....Please check Your Email</p>
<p>
<a href="index.php"><button class="button button--success" data-for="js_success-popup">OK</button></a>
</p>
</div>
</div>
<?php } else { ?>
<link rel="stylesheet" href="assets/popup_style.css">
<div class="popup popup--icon -error js_error-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Error
</h1>
<p>Please Enter Valid Email OR Try Again ... </p>
<p>
<a href="fpassword.php"><button class="button button--error" data-for="js_error-popup">Close</button></a>
</p>
</div>
</div>
<?php } ?>
<?php
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<title>Admin Dashboard</title>
<meta content="" name="" />
<meta content="" name="" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="assets/images/<?php echo $key1['photos']; ?>">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="assets/css/popup_style.css" rel="stylesheet" type="text/css">
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<style>
body {
background-image: url('nature1.jpg');
}
</style>
</head>
<body>
<!-- Begin page -->
<div class="wrapper-page row align-items-center">
<div class="col-md-6 ">
<img src="../assets/images/new/2.jpg" class="vh-100" width="100%">
</div>
<div class="col-md-6 bg-white hv-100 d-flex align-items-center">
<div class="col-md-8 mx-auto login-form">
<div class="text-center mb-5">
<a href="index.php" class="logo logo-admin"><img src="assets/images/<?php echo $photo1; ?>" alt="logo" width="300px"></a>
</div>
<div class="px-3 pb-3">
<form class="form-horizontal m-t-20" action="#" method="POST">
<div class="form-group position-relative mb-4">
<label class="form-label">Email address</label>
<input class="form-control" type="text" name="email" required="" placeholder="Email">
</div>
<div class="form-group text-center row m-t-20">
<div class="col-12">
<button class="btn btn-primary btn-block waves-effect waves-light py-2" type="submit" name="sendmail">Login</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/modernizr.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<!-- App js -->
<script src="assets/js/app.js"></script>
<script>
// Hide show Password Field
$(".toggle-password").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
</script>
</body>
</html>