File: /home/imensosw/public_html/imenso.co/demo/resume-maker/ajax-forgotprocess.php
<?php
require('include/initalizedb.php');
include_once('site_url.php');
$email = $_POST['email'];
$res = $db->select("select * from users where emailAddress = '$email'");
if(!empty($res)) {
$hash = md5(time());
$dataArray = array(
'hash' => $hash
);
$where = array(
'emailAddress' => $email
);
$result = $db->update("users", $dataArray, $where);
// print_r($result);
// exit;
// multiple recipients
$to = $email;
// subject
$subject = 'Password reset request';
$url = PATH."reset-password.php?email=$email&hash=$hash";
// message
$message = '
<html>
<body>
<div style="width:550px;min-height:30px;border:groove 2px #132953;box-shadow:3px 3px 10px rgba(0,0,0,0.5); background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#eee));">
<table >
<thead>
<tr style="background-color:#132953; color:white">
<th colspan="2">
<h1 style="margin:10px; ">Enhan CV</h1>
</th>
<th style="color:white">
<h3 style="margin:10px; ">'. 'Password Reset'.'</h3>
</th>
</tr>
<tr>
<th colspan="3">
<p style="padding:5px 0px;color:#132953;">
Some one has requested to reset the password of your account. If it is you then click on url to reset the password otherwise leave as it is.<br/><font style="color:#000"><a href="'.$url.'" target="_blank" >Click here to reset your Password</a></font>.</p>
</th>
</tr>
</thead>
</table>
</div>
</body>
</html>';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
//mail($to, $subject, $message, $headers);
//$to = $guest_email;
$headers = 'From: Enhan-CV < info@imenso.co >' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//$subject = 'Event Invitation';
// send email
if(mail($to, $subject, $message, $headers ))
{
$response['type'] = 'Success';
$response['message'] = 'Reset link has been sent to you email id. Thanks';
}
else
{
$response['type'] = 'Failed';
$response['message'] = 'Email not found in database';
}
}
else
{
$response['type'] = 'Failed';
$response['message'] = 'Email not found in database';
}
print json_encode($response);
?>