/home/techb158/workloadmatch.com/workloadmatch.com/includes
Edit: /home/techb158/workloadmatch.com/workloadmatch.com/includes/forgetpassword.php (6831B)
success){
//$succMsg = 'Your contact request have submitted successfully.';
$url = "http://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
function getRandomStringd($length)
{
$validCharacters = "ABCDEFGHIJKLMNPQRSTUXYVWZ123456789";
$validCharNumber = strlen($validCharacters);
$result = "";
for ($i = 0; $i < $length; $i++) {
$index = mt_rand(0, $validCharNumber - 1);
$result .= $validCharacters[$index];
}
return $result;
}
function mailresetlink($to,$token,$Teacher_SMS_Carrier){
//echo "".$to." ".$token."";
$subject = "Forgot your password";
$uri = 'https://'. $_SERVER['HTTP_HOST'] ;
$message = '
Workloadmatch: Forgot your password
Dear User,
Click on the given link to reset your password Reset password
"'."Thank you for choosing Workloadmatch.".'"
';
//$headers = "MIME-Version: 1.0" . "\r\n";
//$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
//$headers .= 'From: support
' . "\r\n";
////$headers .= 'Bcc: support' . "\r\n";
$mail = new PHPMailer(true);
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'mail.workloadmatch.com';
$mail->SMTPAuth = true;
$mail->Username = 'support@workloadmatch.com';
$mail->Password = 'qND%cDNnI$97';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
//$to="abala@rsb.qc.ca";
//Recipients
$mail->setFrom('support@workloadmatch.com', 'Workloadmatch Support');
$mail->addAddress($to); // Add a recipient
// Content
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->send();
$Broker_Name="WorkloadMatch";
$Broker_Email="support@workloadmatch.com";
$messages = 'New Update on your file, please visit your profile to view it.';
mail($Teacher_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
header('Location: forgetpassword.php?error=Success - We have sent the password reset link to your email.');
exit();
} catch (Exception $e) {
header('Location: forgetpassword.php?error=Mail could not be sent. Mailer Error: ' . $mail->ErrorInfo);
exit();
}
//if(mail($to,$subject,$message,$headers)){
//$Broker_Name="WorkloadMatch";
//$Broker_Email="support@workloadmatch.com";
////echo "Success
";
////echo "";
//$messages = 'New Update on your file, please visit your profile to view it.';
//mail($Teacher_SMS_Carrier, $subject, "$messages", "From: $Broker_Name <$Broker_Email>\r\n");
//header('Location: forgetpassword.php?error=Success - We have sent the password reset link to your email.');
//exit();
//}else{
// //echo "Warning
";
//header('Location: forgetpassword.php?error=Warning - Sorry, please insert correct information.');
//exit();
//}
}
$Emails =$_POST['email'];
$Names = $_POST['userid'];
$date = date('Y/m/d H:i');
$query = "SELECT * FROM Teacher_Profile where Email ='".$Emails."' and User_Name ='".$Names."'";
$result = $mysqli->query($query);
$Admin = $result->fetch_assoc();
$accessds = $Admin['User_Access'];
$Admin_ID = $Admin['Admin_ID'];
$Manager_ID = $Admin['Manager_ID'];
$Master_ID = $Admin['Master_ID'];
$Teacher_ID = $Admin['Teacher_ID'];
$User_Type_ID = $Admin['User_Type_ID'];
$First_Name = $Admin['First_Name'];
$Last_Name = $Admin['Last_Name'];
if($accessds != "" && $accessds != 0)
{
$Teacher_Phone = $Admin['Phone'];
$Teacher_SMS_Carrier = $Admin['SMS_Carrier'];
if($Teacher_SMS_Carrier !="")
{
$queryee = "SELECT * FROM SMS_Gateways Where Gateways_ID ='".$Teacher_SMS_Carrier."'";
$resultee = $mysqli->query($queryee);
$roweee = $resultee->fetch_assoc();
$Teacher_SMS_Carrier = $Teacher_Phone .''. $roweee['Gateway'];
}
//$token=getRandomStringd(10);
$token=encrypt_decrypt('encrypt', getRandomStringd(10));
//header('Location: forgetpassword.php?error='.$accessds);
$tokens = encrypt_decrypt('decrypt', $token);
if ($insert_stmt = $mysqli->prepare("INSERT INTO tokens (Admin_ID, Master_ID, Manager_ID, Teacher_ID,token,email,first_name,last_name,userid, date) VALUES (?,?,?,?,?,?, ?, ?, ?, ?)")) {
$insert_stmt->bind_param('ssssssssss',$Admin_ID,$Master_ID,$Manager_ID,$Teacher_ID,$tokens,$Emails,$First_Name,$Last_Name,$Names,$date);
// Execute the prepared query.
if (! $insert_stmt->execute()) {
header('Location: forgetpassword.php?error='.$insert_stmt->error);
//header('Location: index.php?error=Warning!');
exit();
}else
{
$to = $_POST['email'];
if(isset($Emails))mailresetlink($to,$token,$Teacher_SMS_Carrier);
header('Location: forgetpassword.php?error=We have sent the password reset link to your email.!');
exit();
}
//header('Location: forgetpassword.php?error='.$mysqli->error);
header('Location: forgetpassword.php?error=Sorry, please insert all information.');
exit();
}
}else{
header('Location: ../forgetpassword.php?error=Please enter your short email address and try again.');
exit();
}
}else{
header('Location: ../forgetpassword.php?error=Robot verification failed, please try again');
exit();
}
}else
{
header('Location: ../forgetpassword.php?error=Please click on the reCAPTCHA box.');
exit();
}
}