HEX
Server: LiteSpeed
System: Linux server137.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: bibuzptr (1123)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/bibuzptr/elearning.bibu-edu.us/old 20th oct/openuni/app/resetlnk-staff.php
<?php
session_start();

include_once('../includes/db_connect.php');
include_once "../includes/swiftmailer/swift_required.php";
$base_url="https://www.softmas.co.ke/openuni/";

if(isset($_POST['email'])){
$email = trim(mysqli_real_escape_string($con, $_POST['email']));
$emencoded = base64_encode($email);
$chkuser = mysqli_query($con,"SELECT * FROM lecturers WHERE email = '$email'");
if(mysqli_num_rows($chkuser) > 0){
 $row = mysqli_fetch_assoc($chkuser);
 $fname = $row["fullname"];
 $link = $base_url."setpasswords/".$emencoded;
 
 $notif = mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM notification_templates WHERE id='2'"));
 
 $transport = Swift_SmtpTransport::newInstance('softmas.co.ke', 465, "ssl")
->setUsername('notifications@softmas.co.ke')
->setPassword('notif2019!');

$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($notif["subject"])
->setFrom(array('notifications@softmas.co.ke' => 'Breakthrough Open University'))
->setTo(array($email => $fname))
->setContentType('text/html; charset=utf-8')
->setBody(str_replace(array("{name}","{link}"),array($fname,$link),$notif["body"]));
$numSent = $mailer->send($message);

echo "success";
 

}else{
    echo "notfound";
}
}
?>