/home/techb158/workloadmatch.com/api
NameSizeModeActions
chat/-0755rm
notifications/-0755rm
reports/-0755rm
routes/-0700rm
teacher/-0755rm
.htaccess7620644editdlrm
admin.php331100644editdlrm
api_functions.php214740644editdlrm
Auth.php45040644editdlrm
change_status.php13320644editdlrm
cors_test.php1840644editdlrm
Database.php9740644editdlrm
db_connect.php6230644editdlrm
forgetpassword.php74150644editdlrm
index.php239320644editdlrm
logout.php11670644editdlrm
psl-config.php3500644editdlrm
reports_schedule_by_course.php12870644editdlrm
reports_schedule_by_group.php13520644editdlrm
Response.php19380644editdlrm
tasks.php29930644editdlrm
teacher_profile.php11770644editdlrm
test.php11130644editdlrm
Edit: /home/techb158/workloadmatch.com/api/forgetpassword.php (7415B)
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 = getenv('SMTP_PASSWORD'); $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"); set_flash_msg('Success - We have sent the password reset link to your email.', 'warning'); header('Location: forgetpassword.php'); exit(); } catch (Exception $e) { set_flash_msg('Mail could not be sent. Mailer Error: ' . $mail->ErrorInfo, 'warning'); header('Location: forgetpassword.php'); 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); if (!$result) { echo json_encode(["status" => "error", "message" => "Database query failed"]); exit(); } $Admin = $result->fetch_assoc(); if ($Admin === null) { echo json_encode(["status" => "error", "message" => "No account found"]); exit(); } $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); if (!$resultee) { echo json_encode(["status" => "error", "message" => "SMS gateway query failed"]); exit(); } $roweee = $resultee->fetch_assoc(); $Teacher_SMS_Carrier = $roweee ? $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()) { set_flash_msg($insert_stmt->error, 'warning'); header('Location: forgetpassword.php'); //header('Location: index.php?error=Warning!'); exit(); }else { $to = $_POST['email']; if(isset($Emails))mailresetlink($to,$token,$Teacher_SMS_Carrier); set_flash_msg('We have sent the password reset link to your email.!', 'warning'); header('Location: forgetpassword.php'); exit(); } //header('Location: forgetpassword.php?error='.$mysqli->error); set_flash_msg('Sorry, please insert all information.', 'warning'); header('Location: forgetpassword.php'); exit(); } }else{ set_flash_msg('Please enter your short email address and try again.', 'warning'); header('Location: ../forgetpassword.php'); exit(); } }else{ set_flash_msg('Robot verification failed, please try again', 'warning'); header('Location: ../forgetpassword.php'); exit(); } }else { set_flash_msg('Please click on the reCAPTCHA box.', 'warning'); header('Location: ../forgetpassword.php'); exit(); } }