| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/sendreg.php |
<?php
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
// include_once($_SERVER['DOCUMENT_ROOT'] . '/phpmailer/PHPMailer.php');
// include_once($_SERVER['DOCUMENT_ROOT'] . '/phpmailer/SMTP.php');
// include_once($_SERVER['DOCUMENT_ROOT'] . '/phpmailer/Exception.php');
// include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/sqlFunctions.php");
// include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/BatchJob.php");
// include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ErrorLog.php");
// include_once($_SERVER['DOCUMENT_ROOT'] . '/php/includes/maill.php');
// use PHPMailer\PHPMailer\PHPMailer;
function CaseCorrect($str)
{
// $newstr = ucwords(strtolower($str));
return $str;
}
function XMail($to, $subject, $msg, $from, $CC, $type = 'html')
{
if ($type == 'html') {
$type = true;
} else {
$type = false;
}
// echo $conni . ' - ' . $db . '<br />';
// exit;
// Save message to be sent later
$mailParameters = [
'to' => $to,
'subject' => $subject,
'msg' => $msg,
'from-name' => 'CESA SCE',
'cc' => [$CC],
'isHTML' => $type,
'from-address' => $from,
];
// $phpScript = "\$mailParameters = json_decode('" . json_encode($mailParameters) . "', true); "
// . "maill(\$mailParameters['to'], \$mailParameters['subject'], \$mailParameters['msg'], null, "
// . "array('from-address' => \$mailParameters['from-address'], 'from-name' => \$mailParameters['from-name'], 'cc' => \$mailParameters['cc'], "
// . "'isHTML' => \$mailParameters['isHTML']));";
// echo $phpScript;
// exit;
// BatchJob::saveJob($phpScript);
$mailOpts = array('from-address' => $from, 'from-name' => 'CESA SCE', 'cc' => array($CC), 'isHTML' => $type);
if (stripos((string) $from, 'blessings@cesa.co.za') !== false || stripos((string) $from, 'sce@cesa.co.za') !== false) {
$mailOpts['reply-to-address'] = 'melissa@cesa.co.za';
}
maill($to, $subject, $msg, null, $mailOpts);
return;
$mail = new PHPMailer;
$mail->Mailer = "mail";
/*
$mail->Mailer="smtp";
$mail->Host="relay.aitonline.co.za";
$mail->Port=587;
$mail->Username="mail@cesa.co.za";
$mail->Password="c3SAmail!@!";
$mail->SMTPDebug=false;
$mail->SMTPAuth=true;
*/
if ($type == "html")
$mail->IsHTML(true);
$mail->From = $from;
$mail->FromName = $from;
$arrto = explode(",", $to);
for ($i = 0; $i < count($arrto); $i++) {
$mail->AddAddress($arrto[$i]);
}
$mail->Subject = $subject;
$mail->Body = $msg;
if (!$mail->Send())
echo $mail->ErrorInfo;
}
$sendto = "sce@cesa.co.za,blessings@cesa.co.za,athromethm@cesa.co.za";
//$sendto .= ",julia@xe.co.za";
// Send GAMA registrations also to Velia
if ($EventID == 187)
$sendto .= ",velia@vdmconferences.co.za";
if (($EventID > 537) && ($EventID < 542))
$sendto .= ",dhermanus@saice.org.za,lizelle@saicepdp.org";
// BEPEC
if (($EventID >= 542) && ($EventID <= 545))
$sendto .= ",ebeth@cesa.co.za,engela@hugoconsult.co.za,roelofvt@cesa.co.za";
if ($EventID == 1227)
$sendto .= ",jeshika@iliso.com";
$sendfrom = "blessings@cesa.co.za";
// $sendto = "julia@xe.co.za";
$EventID = $_POST["EventID"];
$Organisation = $_POST["Organisation"];
$CompanyType = $_POST["CompanyType"];
$Address1 = $_POST["Address1"];
$Address2 = $_POST["Address2"];
$Province = $_POST["profile_province"];
$Country = $_POST["profile_country"];
$City = $_POST["City"];
$PostalCode = $_POST["PostalCode"];
$OrderNumber = $_POST["OrderNumber"];
$VATNumber = $_POST["VATNumber"];
$SAACEMemNum = $_POST["SAACEMemNum"];
$BookingName = $_POST["BookingName"];
$BookingTel = $_POST["BookingTel"];
//$BookingFax = $_POST["BookingFax"];
$BookingEmail = $_POST["BookingEmail"];
$ResponsiblePayment = $_POST["ResponsiblePayment"];
$MarketingSource = $_POST["MarketingSource"];
$HRManagerName = $_POST["HRManagerName"];
$HRManagerCellNo = $_POST["HRManagerCellNo"];
$HRManagerEMail = $_POST["HRManagerEMail"];
$ResponsiblePaymentName = $_POST["ResponsiblePaymentName"];
$ResponsiblePaymentCellNo = $_POST["ResponsiblePaymentCellNo"];
$ResponsiblePaymentDesignation = $_POST["ResponsiblePaymentDesignation"];
$bFormErrors = false;
$sendMail = 1;
if (!reCaptcha($_POST["g-recaptcha-response"])) {
$bFormErrors = true;
$sError[] = "You could not be verified as not being a robot, please tick the reCaptcha verification option at the bottom of the form.";
}
if (!isset($_POST["checkTCs"]) || empty($_POST["checkTCs"])) {
$bFormErrors = true;
$sError[] = "You have not accepted the terms and conditions.";
}
if (!isset($_POST["checkPerm"]) || empty($_POST["checkPerm"])) {
$bFormErrors = true;
$sError[] = "You have not confirmed that payment has been authorised.";
}
// Helper to validate max length
function _len_exceeds($val, $max)
{
return isset($val) && (mb_strlen($val) > $max);
}
// Server-side max length validation for top-level fields
if (_len_exceeds($Organisation, 255)) {
$bFormErrors = true;
$sError[] = "Organisation may not exceed 255 characters.";
}
if (_len_exceeds($Address1, 255)) {
$bFormErrors = true;
$sError[] = "Address line 1 may not exceed 255 characters.";
}
if (_len_exceeds($Address2, 255)) {
$bFormErrors = true;
$sError[] = "Address line 2 may not exceed 255 characters.";
}
if (_len_exceeds($City, 50)) {
$bFormErrors = true;
$sError[] = "City may not exceed 50 characters.";
}
if (_len_exceeds($PostalCode, 20)) {
$bFormErrors = true;
$sError[] = "Postal code may not exceed 20 characters.";
}
if (_len_exceeds($OrderNumber, 50)) {
$bFormErrors = true;
$sError[] = "Purchase Order Number may not exceed 50 characters.";
}
if (_len_exceeds($VATNumber, 50)) {
$bFormErrors = true;
$sError[] = "VAT Number may not exceed 50 characters.";
}
if (_len_exceeds($SAACEMemNum, 50)) {
$bFormErrors = true;
$sError[] = "CESA account number may not exceed 50 characters.";
}
if (_len_exceeds($BookingName, 255)) {
$bFormErrors = true;
$sError[] = "Your name may not exceed 255 characters.";
}
if (_len_exceeds($BookingTel, 50)) {
$bFormErrors = true;
$sError[] = "Your telephone may not exceed 50 characters.";
}
if (_len_exceeds($BookingEmail, 255)) {
$bFormErrors = true;
$sError[] = "Your email may not exceed 255 characters.";
}
if (_len_exceeds($ResponsiblePayment, 255)) {
$bFormErrors = true;
$sError[] = "Responsible for payment (email) may not exceed 255 characters.";
}
if (_len_exceeds($ResponsiblePaymentName, 255)) {
$bFormErrors = true;
$sError[] = "Responsible payment name may not exceed 255 characters.";
}
if (_len_exceeds($ResponsiblePaymentCellNo, 255)) {
$bFormErrors = true;
$sError[] = "Responsible payment cell no may not exceed 255 characters.";
}
if (_len_exceeds($ResponsiblePaymentDesignation, 255)) {
$bFormErrors = true;
$sError[] = "Responsible payment designation may not exceed 255 characters.";
}
if (_len_exceeds($HRManagerName, 255)) {
$bFormErrors = true;
$sError[] = "HR Manager name may not exceed 255 characters.";
}
if (_len_exceeds($HRManagerCellNo, 20)) {
$bFormErrors = true;
$sError[] = "HR Manager cell no may not exceed 20 characters.";
}
if (_len_exceeds($HRManagerEMail, 255)) {
$bFormErrors = true;
$sError[] = "HR Manager email may not exceed 255 characters.";
}
if (_len_exceeds($MarketingSource, 255)) {
$bFormErrors = true;
$sError[] = "Marketing source may not exceed 255 characters.";
}
if (empty($BookingName)) {
$bFormErrors = true;
$sError[] = "Your name is required.";
}
if (empty($Organisation)) {
$bFormErrors = true;
$sError[] = "Your organisation is required.";
}
if (empty($Address1)) {
$bFormErrors = true;
$sError[] = "Your address is required.";
}
if (empty($City)) {
$bFormErrors = true;
$sError[] = "Your city is required.";
}
if (empty($PostalCode)) {
$bFormErrors = true;
$sError[] = "Your postal code is required.";
}
if (empty($MarketingSource)) {
$bFormErrors = true;
$sError[] = "Please let us know where you heard about us.";
}
for ($i = 1; $i <= 10; $i++) {
if ($_POST["DivDisplayed" . $i] == 1) {
if (empty($_POST["FirstName" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s first name is required.";
}
if (empty($_POST["Surname" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s surname is required.";
}
/*
if (empty($_POST["KnownAs".$i])) {
$bFormErrors = true;
$sError[] = "Attendee ".$i."'s name \"known as\" is required.";
}
*/
if (empty($_POST["Email" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s email address is required.";
}
if (empty($_POST["Tel" . $i]) && empty($_POST["Mobile" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s telephone number is required.";
}
if (preg_match("/[^0-9\ \(\)\+]+$/", $_POST["Tel" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s telephone number is invalid.";
}
if (preg_match("/[^0-9\ \(\)\+]+$/", $_POST["Mobile" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s mobile number is invalid.";
}
// Length checks per attendee
if (_len_exceeds($_POST["Designation" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s designation may not exceed 50 characters.";
}
if (_len_exceeds($_POST["FirstName" . $i], 30)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s first name may not exceed 30 characters.";
}
if (_len_exceeds($_POST["Surname" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s surname may not exceed 50 characters.";
}
if (_len_exceeds($_POST["IDNumber" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s ID Number may not exceed 50 characters.";
}
if (_len_exceeds($_POST["ECSANumber" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s ECSA Number may not exceed 50 characters.";
}
if (_len_exceeds($_POST["SAICENumber" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s SAICE Number may not exceed 50 characters.";
}
if (_len_exceeds($_POST["Email" . $i], 255)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s email may not exceed 255 characters.";
}
if (_len_exceeds($_POST["Tel" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s telephone may not exceed 50 characters.";
}
if (_len_exceeds($_POST["Mobile" . $i], 50)) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s mobile may not exceed 50 characters.";
}
}
}
if (!$bFormErrors) {
// Save all the form fields
foreach ($_POST as $FieldName => $FieldValue) {
$sql = "INSERT INTO EventFormFields (EventID, FirstName, LastName, FieldName, FieldValue, DateCreated) VALUES ('" . $EventID . "', '" . $FirstName . "', '" . $Surname . "', '" . $FieldName . "', '" . $FieldValue . "', '" . date("Y-m-d H:i") . "')";
$queryresult = mysql_query($sql);
}
//Send the confirmation
//ini_set("SMTP", "SAACEMAIL");
$sql = "SELECT SchoolEvents.EventName, SchoolEvents.EventName, SchoolEvents.Level, SchoolEvents.City, SchoolEvents.Venue, SchoolEvents.RegDeadline,
SchoolEvents.MemberDiscount, SchoolEvents.EarlyBirdDiscount, SchoolEvents.BankAccName,
SchoolEvents.AvailableSpaces, SchoolEvents.CostPerPerson, SchoolCourses.`TrainingProviderID`,
SchoolEvents.Hours, SchoolEvents.CPD, SchoolEvents.CODE,
SchoolEvents.NQFLevel, SchoolEvents.AccredNum, SchoolEvents.Province, SchoolEvents.CopyRegFormTo, MIN(EventSchedules.ScheduleDate) AS StartDate,
MAX(EventSchedules.ScheduleDate) AS EndDate, SchoolEvents.SendRegistrationConfirmation, SchoolEvents.PilotCourse
FROM SchoolEvents INNER JOIN SchoolCourses ON (SchoolEvents.`SchoolCourseID`=SchoolCourses.`SchoolCourseID`)
LEFT JOIN EventSchedules ON SchoolEvents.EventID=EventSchedules.EventID
WHERE SchoolEvents.EventID=" . $EventID . "
GROUP BY SchoolEvents.EventName, SchoolEvents.EventName, SchoolEvents.Level, SchoolEvents.CourseType, SchoolEvents.City, SchoolEvents.Venue, SchoolEvents.RegDeadline,
SchoolEvents.MemberDiscount, SchoolEvents.EarlyBirdDiscount, SchoolEvents.BankAccName,
SchoolEvents.AvailableSpaces, SchoolEvents.CostPerPerson, SchoolCourses.`TrainingProviderID`,
SchoolEvents.Hours, SchoolEvents.CPD, SchoolEvents.CODE,
SchoolEvents.NQFLevel, SchoolEvents.AccredNum, SchoolEvents.Province, SchoolEvents.CopyRegFormTo
ORDER BY StartDate";
$queryresult = mysql_query($sql);
if ($row = mysql_fetch_array($queryresult)) {
$CostPrice = $row["CostPerPerson"];
$CopyRegFormTo = $row["CopyRegFormTo"];
$sendMail = $row['SendRegistrationConfirmation'];
if ($row["TrainingProviderID"] == 45)
$sendto .= ",lizelle@saicepdp.org";
if (!empty($row["CopyRegFormTo"]))
$sendto .= "," . $row["CopyRegFormTo"];
//*$incvat;
// Member Discount
if (!empty($row["MemberDiscount"]) && ($row["MemberDiscount"] > 0) && (!empty($SAACEMemNum))) {
$CostPrice = $CostPrice - $row["MemberDiscount"];
}
// Early Bird Discount
if (!empty($row["EarlyBirdDiscount"]) && ($row["EarlyBirdDiscount"] > 0) && (!empty($row["RegDeadline"]))) {
// Early bird deadline is midnight of that day
if ((strtotime($row["RegDeadline"]) + 86400) > time()) {
$CostPrice = $CostPrice - $row["EarlyBirdDiscount"];
}
}
// Bank account
$sBankAccName = "SAACE";
if (!empty($row["BankAccName"]))
$sBankAccName = $row["BankAccName"];
$sqlbank = "SELECT * FROM SchoolBankAccs WHERE BankAccName = '" . $sBankAccName . "'";
$recbank = mysql_query($sqlbank);
if ($rowbank = mysql_fetch_assoc($recbank)) {
extract($rowbank);
}
// Venue details
$Venue = "";
if (!empty($row["Venue"]))
$sVenue = $row["Venue"];
$sqlvenue = "SELECT * FROM CourseVenues WHERE CourseVenueName = '" . $sVenue . "'";
$recvenue = mysql_query($sqlvenue);
if ($rowvenue = mysql_fetch_assoc($recvenue)) {
extract($rowvenue);
}
$files = '';
if ($handle = opendir('../school/eventdocs')) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$tofind = "." . $EventID;
$pos = strpos($file, $tofind);
if ($pos > 0) {
$handle2 = opendir('../school/eventdocs/' . $file);
while (false !== ($file2 = readdir($handle2))) {
if (substr($file2, 0, 1) != ".") {
//$files .= str_replace(" ", "%20", urlencode('https://www.cesa.co.za/school/eventdocs/'.$file.'/'.$file2)).chr(10).chr(13);
$files .= str_replace(" ", "%20", 'https://www.cesa.co.za/school/eventdocs/' . $file . '/' . $file2) . chr(10) . chr(13);
}
}
closedir($handle2);
}
}
}
closedir($handle);
}
$formmsgtop = '<html><body><img align=left src=https://www.cesa.co.za/images/cesa.gif>
<h1 align=center>REGISTRATION FORM<br>
<br>
<u>' . $row["EventName"] . '</u></h1>
<table border=1 cellspacing=0 cellpadding=2 width=100%>
<tr>
<td valign=top> <p><b>Dates & Times</b></p></td>
<td valign=top> <p><b>Venue</b></p></td>
</tr>
<tr>
<td nowrap> <p align=center style=text-align:center>';
$sql2 = "SELECT * FROM EventSchedules WHERE EventID=" . $EventID . " ORDER BY ScheduleDate";
$queryresult2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($queryresult2)) {
$formmsgtop .= "<b>·</b>" . date("D j F Y", strtotime($row2["ScheduleDate"])) . "<br>" . substr($row2["StartTime"], 0, 5) . " to " . substr($row2["EndTime"], 0, 5) . "<BR><br>";
}
$formmsgtop .= '</p></td>
<td>' . $row["Venue"] . '<br>' . $CourseVenueCity . '</td>
</tr>
</table>
<table width=100% border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style=clear:both>
<tr>
<td valign=top> <p>Organisation:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Organisation . '</td>
<td valign=top> <p>Purchase order number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $OrderNumber . '</td>
</tr>
<tr>
<td valign=top> <p>CESA account number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $SAACEMemNum . '</td>
<td valign=top> <p>VAT number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $VATNumber . '</td>
</tr>
<tr>
<td valign=top> <p>Postal Address:</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $Address1 . '</td></tr>
<tr>
<td valign=top> <p>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $Address2 . '</td></tr>
<tr>
<td valign=top> <p>City:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $City . '</td><td valign=top> <p>Postal code:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $PostalCode . '</td></tr>
<tr>
<td valign=top> <p>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $Province . '</td></tr>
<tr>
<td valign=top> <p>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $Country . '</td></tr>
<tr>
<td valign=top> <p><strong>Booked By:</strong></p></td>
<td valign=top bgcolor=#FFFFFF>' . $BookingName . '</td>
<td valign=top> <p>Tel:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $BookingTel . '</td>
</tr>
<tr>
<td valign=top> <p>Email:</p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $BookingEmail . '</td>
</tr>
<tr>
<td valign=top> <p><strong>HR Manager:</strong></p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $_POST["HRManagerName"] . '</td>
</tr>
<tr>
<td valign=top> <p>Cell No:</p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $_POST["HRManagerCellNo"] . '</td>
</tr>
<tr>
<td valign=top> <p>Email:</p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $_POST["HRManagerEMail"] . '</td>
</tr>';
if ($row["PilotCourse"] <= 0) {
$formmsgtop .= '<tr><td colspan=2>Responsible for payment:</td>
<td colspan=2>' . $ResponsiblePayment . '</td></tr>
<tr><td colspan=2>Responsible for payment - Name:</td>
<td colspan=2>' . $_POST["ResponsiblePaymentName"] . '</td></tr>
<tr><td colspan=2>Responsible for payment - Cell No:</td>
<td colspan=2>' . $_POST["ResponsiblePaymentCellNo"] . '</td></tr>
<tr><td colspan=2>Responsible for payment - Designation:</td>
<td colspan=2>' . $_POST["ResponsiblePaymentDesignation"] . '</td></tr>';
}
$formmsgtop .= '<tr><td colspan=2>Where did you hear about us?</td>
<td colspan=2>' . $MarketingSource . '</td></tr>
</table> ';
$iNumInserted = 0;
$iNumDuplicates = 0;
$formmsg = "";
for ($i = 1; $i <= 10; $i++) {
if ($_POST["DivDisplayed" . $i] == 1) {
$Designation = $_POST["Designation" . $i];
$Title = $_POST["Title" . $i];
$FirstName = $_POST["FirstName" . $i];
$Surname = $_POST["Surname" . $i];
// $KnownAs = $_POST["KnownAs".$i];
$Tel = $_POST["Tel" . $i];
$Mobile = $_POST["Mobile" . $i];
//$Fax = $_POST["Fax".$i];
$Email = $_POST["Email" . $i];
$DietaryReq = $_POST["DietaryReq" . $i];
$IDNumber = $_POST["IDNumber" . $i];
$ECSANumber = $_POST["ECSANumber" . $i];
$SAICENumber = $_POST["SAICENumber" . $i];
$Institute = $_POST["profile_institute" . $i];
$PackageChosen = 'No packages applicable to this course';
if (isset($_POST["PackageChosen" . $i]))
$PackageChosen = $_POST["PackageChosen" . $i];
$YearsExperience = $_POST["YearsExperience" . $i];
$iParking = 0;
$sParking = "";
if (isset($_POST["Parking" . $i])) {
$sParking = "No";
if ($_POST["Parking" . $i] == 1) {
$iParking = 1;
$sParking = "Yes";
}
}
$bInserted = false;
// Try to correct case
$FirstName = CaseCorrect($FirstName);
$Surname = CaseCorrect($Surname);
//$KnownAs = CaseCorrect($KnownAs);
$KnownAs = $FirstName;
// Check for duplicates
$sql = "SELECT * FROM SchoolAttendees WHERE ContactFirstName='" . $FirstName . "'
AND ContactLastName='" . $Surname . "'
AND PhoneNumber='" . $Tel . "'
AND EmailAddress='" . $Email . "'
AND EventID=" . $EventID;
$queryresult = mysql_query($sql);
if ($queryrows = mysql_fetch_assoc($queryresult)) {
// echo "You are already registered for this event!";
// die();
$iNumDuplicates++;
} else {
$bookingformhtml = '<table width=100% border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style=clear:both>
<tr>
<td valign=top> <p><strong>Attendee ' . $i . '</strong></p></td>
<td valign=top bgcolor=#FFFFFF> </td>
<td valign=top bgcolor=#FFFFFF> </td>
<td valign=top bgcolor=#FFFFFF> </td>
</tr>
<tr>
<td valign=top> <p>Title:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Title . '</td>
<td valign=top> <p>Designation:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Designation . '</td>
</tr>
<tr>
<td valign=top> <p>First Name:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $FirstName . '</td>
<td valign=top> <p>Surname:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Surname . '</td>
</tr>
<tr>
<td valign=top> <p>ID Number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $IDNumber . '</td>
<td> </td> <td> </td>
</tr>
<tr>
<td valign=top> <p>ECSA registration number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $ECSANumber . '</td>
<td> </td><td> </td>
</tr>
<tr>
<td valign=top> <p>SAICE member number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $SAICENumber . '</td>
<td> </td><td> </td>
</tr>
<tr>
<td valign=top> <p>Professional Association:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Institute . '</td>
<td> </td><td> </td>
</tr>
<tr>
<td valign=top> <p>Telephone:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Tel . '</td><td valign=top> <p>Mobile: </p></td>
<td valign=top bgcolor=#FFFFFF>' . $Mobile . '</td></tr>
<tr>
<td valign=top> <p>E-mail:
</p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $Email . '</td></tr>
<tr>
<td valign=top> <p><b>Dietary restrictions / allergies:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $DietaryReq . '</td></tr>';
if ($row["PilotCourse"] <= 0) {
$bookingformhtml .= '<tr>
<td valign=top> <p><b>Cost package chosen:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $PackageChosen . '</td></tr>';
}
$bookingformhtml .= '<tr>
<td valign=top> <p><b>Parking:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $sParking . '</td></tr>
<tr>
<td valign=top> <p><b>Years of Experience:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $YearsExperience . '</td></tr>
</table> ';
$sql = "INSERT INTO SchoolAttendees (ContactTitle, ContactFirstName, ContactLastName, CompanyName, AddressLine1,
AddressLine2, AddressLine3, City, PostalCode, PhoneNumber, MobileNumber, EmailAddress, DietaryReq, EventID, Attended,
OrderNum, OrgVATNum, IDNumber, SAACEMemNumber, ECSANumber, SAICEMemNumber, Designation, BookingName, BookingTel,
BookingEmail, KnownAs, CompanyType, DateBooked, BookingForm, ResponsiblePayment, ResponsiblePaymentName,
ResponsiblePaymentCellNo, ResponsiblePaymentDesignation, MarketingSource, PackageChosen, Parking, Province, Country,
ProfAssoc, YearsExperience, Subscribed, HRManagerName, HRManagerCellNo, HRManagerEMail)
VALUES ('" . mysql_real_escape_string($Title) . "', '" . mysql_real_escape_string($FirstName) . "',
'" . mysql_real_escape_string($Surname) . "', '" . mysql_real_escape_string($Organisation) . "',
'" . mysql_real_escape_string($Address1) . "', '" . mysql_real_escape_string($Address2) . "',
'" . mysql_real_escape_string($Address3) . "', '" . mysql_real_escape_string($City) . "', '" . $PostalCode . "',
'" . $Tel . "', '" . $Mobile . "', '" . $Email . "', '" . mysql_real_escape_string($DietaryReq) . "',
" . $EventID . ", 'y', '" . mysql_real_escape_string($OrderNumber) . "', '" . $VATNumber . "', '" . $IDNumber . "',
'" . $SAACEMemNum . "', '" . $ECSANumber . "', '" . $SAICENumber . "',
'" . mysql_real_escape_string($Designation) . "', '" . mysql_real_escape_string($BookingName) . "',
'" . $BookingTel . "', '" . $BookingEmail . "', '" . mysql_real_escape_string($KnownAs) . "', '" . $CompanyType . "',
'" . date("Y-m-d H:i:s") . "', '" . mysql_real_escape_string($formmsgtop . $bookingformhtml) . "',
'" . mysql_real_escape_string($ResponsiblePayment) . "',
'" . mysql_real_escape_string($_POST["ResponsiblePaymentName"]) . "',
'" . mysql_real_escape_string($_POST["ResponsiblePaymentCellNo"]) . "',
'" . mysql_real_escape_string($_POST["ResponsiblePaymentDesignation"]) . "',
'" . mysql_real_escape_string($MarketingSource) . "', '" . mysql_real_escape_string($PackageChosen) . "',
" . $iParking . ", '" . mysql_real_escape_string($Province) . "', '" . mysql_real_escape_string($Country) . "',
'" . mysql_real_escape_string($Institute) . "', '" . floatval($YearsExperience) . "',
'" . mysql_real_escape_string($_REQUEST["subscribe"]) . "',
'" . mysql_real_escape_string($_POST["HRManagerName"]) . "',
'" . mysql_real_escape_string($_POST["HRManagerCellNo"]) . "',
'" . mysql_real_escape_string($_POST["HRManagerEMail"]) . "')";
$queryresult = mysql_query($sql);
if (!$queryresult) {
XMail(
"sce@igotafrica.com", "Error on school db insert", "Error on school db insert: " . $sql . "\r\n\r\n"
. mysql_error(get_current_connection())
, "sce@cesa.co.za", "", "text");
} else {
$bInserted = true;
$iNumInserted++;
mysql_query("INSERT INTO SchoolSubscribe (EmailAddress, DateSubscribed) VALUES ('" . $BookingEmail . "', '" . date("Y-m-d H:i:s") . "')");
}
} //attendee check
if ($bInserted) {
$FirstName = stripslashes($FirstName);
$Surname = stripslashes($Surname);
$CourseType = $row["Level"];
if (empty($CourseType))
$CourseType = "Course";
$msg = "<p>Dear " . $FirstName . " " . $Surname . ",</p>"
. "<p>We are delighted to have received your online delegate registration for '" . $row["EventName"] . "' to be held online on "
. SchoolEvents::getEventDatesString($row, true) . ".</p>"
. "<p>Please note that this is an automatic response.</p>";
if ($row["PilotCourse"] <= 0 && $CostPrice > 0) {
$msg .= "<p>To complete your registration, please ensure that your payment is made in full. "
. "Once received, we'll send you an email with the access link to the course.</p>"
. "<p>Your invoice for R " . number_format(ceil(floatval($CostPrice * $incvat)), 2, ".", " ")
. " will be emailed to you soon, so keep an eye out for it. "
. "If you need the invoice urgently, please get in touch with Athrometh. (<a href='mailto:athromethm@cesa.co.za'>AthromethM@CESA.co.za</a>)</p>"
. "<p>Please ensure that you email the proof of payment to Athrometh (athromethm@cesa.co.za) before the start of the course, and add "
. "'delegate name, surname and company' as the reference.</p>"
. "<p>Kindly be aware that failure to show up or pay does not constitute a cancellation. "
. "If you must cancel, please do so in writing prior to the start of the course to avoid incurring fees.</p>";
}
$msg .= "<p>Be advised that your registration form has been forwarded to each of the individuals you specified. </p>";
if ($row["PilotCourse"] <= 0) {
$msg .= "<p>After you have received your invoice and have made payment, please make sure that you send the proof of payment to me and Athrometh (<a href='mailto:athromethm@cesa.co.za'>athromethm@cesa.co.za</a>) "
. "before you attend the course.</p>";
}
$msg .= "<p>Should you require any further information or assistance, please don't hesitate to contact me on "
. "<a href='mailto:blessings@cesa.co.za'>blessings@cesa.co.za</a> or (011) 463 2022</p>"
. "<p>With kind regards,</p>"
. "<p>Blessings Banda</p>"
. "<p>Coordinator: Training and Continuing Professional Development (CPD)<br />"
. "CESA School of Consulting Engineering</p>";
if ($sendMail > 0) {
$confirmationMail = "<html>
<head>
<style>
body, td {
font-family: Arial, Verdana, sans-serif;
font-size: 11pt;
}
</style>
</head>
<body><img src='https://www.cesa.co.za/images/CESA_site-header.jpg' align='center'><br>" . $msg . "</body></html>";
XMail(
$Email . "," . $BookingEmail . ',' . $HRManagerEMail . ',' . $ResponsiblePaymentEMail,
"Confirmation of School of Consulting Engineering Registration",
$confirmationMail,
$sendfrom,
"",
"html"
);
}
$formmsg .= '<table width=100% border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style=clear:both>
<tr>
<td valign=top> <p><strong>Attendee ' . $i . '</strong></p></td>
<td valign=top bgcolor=#FFFFFF> </td>
<td valign=top bgcolor=#FFFFFF> </td>
<td valign=top bgcolor=#FFFFFF> </td>
</tr>
<tr>
<td valign=top> <p>Title:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Title . '</td>
<td valign=top> <p>Designation:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Designation . '</td>
</tr>
<tr>
<td valign=top> <p>First Name:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $FirstName . '</td>
<td valign=top> <p>Surname:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Surname . '</td>
</tr>
<tr>
<td valign=top> <p>ID Number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $IDNumber . '</td>
<td> </td> <td> </td>
</tr>
<tr>
<td valign=top> <p>ECSA registration number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $ECSANumber . '</td>
<td> </td><td> </td>
</tr>
<tr>
<td valign=top> <p>SAICE member number:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $SAICENumber . '</td>
<td> </td><td> </td>
</tr>
<tr>
<td valign=top> <p>Telephone:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Tel . '</td><td valign=top> <p>Mobile: </p></td>
<td valign=top bgcolor=#FFFFFF>' . $Mobile . '</td></tr>
<tr>
<td valign=top> <p>E-mail:
</p></td>
<td valign=top bgcolor=#FFFFFF colspan=3>' . $Email . '</td></tr>
<tr>
<td valign=top> <p><b>Dietary restrictions / allergies:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $DietaryReq . '</td></tr>';
if ($row["PilotCourse"] <= 0) {
$formmsg .= '<tr>
<td valign=top> <p><b>Cost package chosen:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $PackageChosen . '</td></tr>';
}
$formmsg .= '<tr>
<td valign=top> <p><b>Parking:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $sParking . '</td></tr>
<tr>
<td valign=top> <p>HR Manager Name:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $HRManagerName . '</td>
<td valign=top> <p>HR Manager Cell No:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $HRManagerCellNo . '</td>
</tr>
<tr>
<td valign=top> <p>HR Manager Email:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $HRManagerEMail . '</td>
<td colspan="2"> </td>
</tr>
<tr>
<td valign=top> <p>Responsible Payment Name:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $ResponsiblePaymentName . '</td>
<td valign=top> <p>Responsible Payment Cell No:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $ResponsiblePaymentCellNo . '</td>
</tr>
<tr>
<td valign=top> <p>Responsible Payment Designation:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $ResponsiblePaymentDesignation . '</td>
<td colspan="2"> </td>
</tr>
</table> ';
} //attendee was inserted
} //attendee was displayed
} //foreach attendee
if ($iNumInserted == 0) {
?>
<p><b>No attendees were registered.</b></p>
<?php
if ($iNumDuplicates > 0) {
echo "<p><b>" . $iNumDuplicates . " duplicate(s) were found, these attendees have already been registered for this event.</b></p>";
}
} else {
$formmsgend = "";
if ($EventID == 187) {
ob_start();
$showform = false;
include("inc_gama.php");
$formmsgend .= ob_get_clean();
}
$formmsgend .= '<p align=left><i><span style=color:red">';
if ($row["PilotCourse"] <= 0) {
// $formmsgend .= 'Note: Your booking will only be confirmed upon receipt of a formal/written confirmation from either parties and/or proof of payment thereof.<br>'
// . 'No refunds will be awarded if delegates cancel within 5 working days / Substitutions of delegates will be allowed.<br>';
}
$formmsgend .= 'CESA endeavors to send notice of confirmation/ cancellations and postponements of its training courses '
. 'at least 5 working days before the course date/s and hence will not be liable for costs incurred for accommodation and'
. 'transport arrangements made for delegates prior to this period -'
. 'CESA reserves the right to request related proof in the event that cancellations/ postponements of courses occur within the 5-day period.</span></i></p>'
. '<table border=1 width=100% cellspacing=0 cellpadding=5>'
. '<tr><td colspan=4><b><i><u>For office use only.</u></i></b></td></tr>'
. '<tr><td>Date: _________________</td><td>Acc No: ________________________</td>'
. '<td>Invoice No: _____________________ </td><td>Code: __________________</td></tr>'
. '</table></body></html>';
// ErrorLog::logError('Sending notification to CESA: ' . $formmsgtop . $formmsg . $formmsgend);
XMail($sendto, "SCE Event Registration from Website", $formmsgtop . $formmsg . $formmsgend, $sendfrom, "", "html");
if ($row['CourseType'] == 'Inhouse Client Course') {
// Send confirmation to the person who registered
XMail($_POST["BookingEmail"], "SCE Event Registration from Website", $formmsgtop . $formmsg . $formmsgend, $sendfrom, "", "html");
}
?>
<p><b>Thank you for registering. Confirmation messages have been sent to the attendees' email addresses. </b></p>
<?php
echo $formmsgtop . $formmsg;
}
}
}
// include_once($_SERVER['DOCUMENT_ROOT'] . '/php/templates/inc_footer.php');