<?php 
ob_start();
session_start();
ini_set("display_errors", 0);

require_once("config.php");

// Stop making changes below this line
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'phpmailer/PHPMailer-master/src/Exception.php';
require 'phpmailer/PHPMailer-master/src/PHPMailer.php';
require 'phpmailer/PHPMailer-master/src/SMTP.php';
?>

<?php
$sqlForgot = "SELECT * FROM `og_users` WHERE `email` = '".$_POST['femail']."'";
$exeForgot = mysqli_query($connection,$sqlForgot);
$numForgot = mysqli_num_rows($exeForgot);
if($numForgot>0)
{
	$arrForgot = mysqli_fetch_array($exeForgot);
	$name8 = stripslashes($arrForgot['fname'])." ".stripslashes($arrForgot['lname']); 
	$email8 = stripslashes($arrForgot['email']);
	
	//SEND EMAIL TO USER
	$email_account = "info@prismonline.in";
    $email_password = "~I5er1FU&bR0";

	// Recipient
	$mail = new PHPMailer;
	$mail->isSMTP();
	$mail->SMTPDebug = 0;

	$subject = 'Forgot Password';	
	$message = '<table border="0" width="100%" cellspacing="2" cellpadding="2">
				<tr>
					<td>Dear '.$name8.',</td>
				</tr>
				<tr>
    			    <td>&nbsp;</td>
        		</tr>
        		<tr>
        			<td>We are sorry that you misplaced your password, but not to worry. Your reset password link is below,</td>
        		</tr>
        		<tr>
        			<td><a href="'.SITE_URL.'reset-password.php?uid='.md5($arrForgot['member_id']).'">'.SITE_URL.'reset-password.php?uid='.$arrForgot['user_id'].'</a></td>
        		</tr>
        		<tr>
        			<td>&nbsp;</td>
        		</tr>
        		<tr>
        			<td>Thanks & Regards,<br>Flaro Deals Team</td>
        		</tr>
				</table>';

	$mail->Host = 'mail.prismonline.in';
	$mail->Port = 587;
	$mail->SMTPAuth = true;
	$mail->SMTPSecure = "tls";
	$mail->Username = $email_account;
	$mail->Password = $email_password;

	$mail->setFrom('info@prismonline.in', "Flaro Deals");
	$mail->addReplyTo('info@prismonline.in', "");
	$mail->addAddress($email8);
	$mail->Subject = $subject;
	$TemplateMessage = $message;
	$mail->MsgHTML($TemplateMessage);
	$mail->send();

	echo 'succ';
}
else
{
	echo 'fail';
}
?>