| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/marketingevent.php |
<?php
//ini_set('display_errors', 0);
//error_reporting(E_NONE);
if (!isset($id))
$id = $_REQUEST["id"];
$id = intval(trim($id));
if (!isset($submitformto))
$submitformto = "/eventreg";
include_once($_SERVER['DOCUMENT_ROOT'] . '/cfg/config.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');
$sqlf = $GLOBALS['sqlf'] ?? null;
if ($sqlf === null) {
throw new \RuntimeException('CESA database layer (sqlf) not initialized.');
}
$marketingAttendeeObj = new MarketingAttendees($sqlf);
include __DIR__ . '/inc_db.php';
if (intval(trim($id)) == 323) {
//replace 2024 Indaba ID with 2025 id
$id = 432;
}
$bShowFormBooker = false;
$bShowFormInvoicing = false;
$bMinimalRegForm = false;
$earlyEventQuery = mysql_query(
'SELECT RegFormBooker, RegFormInvoicing, MinimalRegForm FROM MarketingEvents WHERE EventID=' . intval($id)
);
if ($earlyEventQuery && ($earlyRow = mysql_fetch_array($earlyEventQuery))) {
$bShowFormBooker = ($earlyRow['RegFormBooker'] == 1);
$bShowFormInvoicing = ($earlyRow['RegFormInvoicing'] == 1);
$bMinimalRegForm = ($earlyRow['MinimalRegForm'] == 1);
}
// use PHPMailer\PHPMailer\PHPMailer;
$sOrgName = "CESA";
$sContactEmail = "events@cesa.co.za";
$sSubmitTo = "CESA";
$sendto = "events@cesa.co.za,athromethm@cesa.co.za";
$sendfrom = "bonolo@cesa.co.za";
$Notify = "cesa-marketing-events@igotafrica.com"; // System admin notification (same as trainerportal)
//$sEmailFooter = "<p><b>Consulting Engineers South Africa</b><br>Tel: 011 463 2022<br>Website: www.cesa.co.za</p><p><img src='https://www.cesa.co.za/images/emailfooter.jpg'></p>";
$sEmailFooter = '
<div>
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td width="10" style="width:7.5pt;padding:0in 0in 0in 0in"></td>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:12.75pt">
<td style="padding:0in 0in 0in 0in;height:12.75pt"></td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%;border-collapse:collapse">
<tbody>
<tr>
<td valign="bottom" style="padding:0in 0in 0in 0in">
</td>
<td width="15" nowrap="" style="width:11.25pt;padding:0in 0in 0in 0in"></td>
<td width="200" style="width:150.0pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:1.0pt;font-family:"Arial",sans-serif">
<img border="0" width="200" height="90" style="width:2.0833in;height:.9375in" id="m_-6767754479392180719_x0000_i1031" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/images/621fb81cd3bb0.jpeg?override=1646382274" alt=" " class="CToWUd"></span><span style="font-size:1.0pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="height:7.5pt">
<td style="padding:0in 0in 0in 0in;height:7.5pt"></td>
</tr>
<tr style="height:.75pt">
<td style="border:none;border-bottom:solid #325eab 3.0pt;padding:0in 0in 0in 0in;height:.75pt">
</td>
</tr>
<tr style="height:7.5pt">
<td style="padding:0in 0in 0in 0in;height:7.5pt"></td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%;border-collapse:collapse">
<tbody>
<tr>
<td valign="top" style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:12.75pt">
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
<p class="MsoNormal" style="line-height:13.5pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">Office</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">
</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><a href="tel:+27114632022" target="_blank"><span style="color:black;text-decoration:none">+27 11 463 2022</span></a>
<u></u><u></u></span></p>
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td style="padding:0in 0in 0in 0in;height:12.75pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:12.75pt">
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
<p class="MsoNormal" style="line-height:13.5pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">Email:</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">
</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><a href="mailto:events@cesa.co.za" target="_blank"><span style="color:black;text-decoration:none"><span class="il">events</span>@cesa.co.za</span></a>
<u></u><u></u></span></p>
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
<p class="MsoNormal" style="line-height:13.5pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">Website:</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">
</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><a href="https://www.cesa.co.za" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.cesa.co.za&source=gmail&ust=1650522310592000&usg=AOvVaw1woLv3M-Mf2AqHC242X60I"><span style="color:black;text-decoration:none">www.cesa.co.za</span></a>
<u></u><u></u></span></p>
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td style="padding:0in 0in 0in 0in;height:12.75pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:12.75pt">
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
<p class="MsoNormal" style="line-height:13.5pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">Address:</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#325eab">
</span><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Kildrummy Office Park, Building 9,
<u></u><u></u></span></p>
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td nowrap="" valign="top" style="padding:0in 0in 0in 0in;height:12.75pt">
<p class="MsoNormal" style="line-height:13.5pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Cnr Witkoppen & Umhlanga Rds, Paulshof
<u></u><u></u></span></p>
</td>
<td width="6" valign="top" style="width:4.5pt;padding:0in 0in 0in 0in;height:12.75pt">
</td>
<td style="padding:0in 0in 0in 0in;height:12.75pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:11.25pt">
<td style="padding:0in 0in 0in 0in;height:11.25pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td nowrap="" style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:13.5pt"><a href="https://www.facebook.com/ConsultingEngineersSA" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.facebook.com/ConsultingEngineersSA&source=gmail&ust=1650522310592000&usg=AOvVaw1A4L8NZ4sST6Xa9GEGx5zB"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;border:none windowtext 1.0pt;padding:0in;text-decoration:none">
<img border="0" width="23" height="24" style="width:.243in;height:.25in" id="m_-6767754479392180719_x0000_i1030" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/icons/621fb6a955fff.jpg" alt=" " class="CToWUd"></span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
</td>
<td width="4" style="width:3.0pt;padding:0in 0in 0in 0in"></td>
<td nowrap="" style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:13.5pt"><a href="https://www.twitter.com/the_cesa" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.twitter.com/the_cesa&source=gmail&ust=1650522310592000&usg=AOvVaw2dVlRjTQ9-GXH5W2Pofh2h"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;border:none windowtext 1.0pt;padding:0in;text-decoration:none">
<img border="0" width="23" height="24" style="width:.243in;height:.25in" id="m_-6767754479392180719_x0000_i1029" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/icons/621fb6fa3ae12.jpg" alt=" " class="CToWUd"></span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
</td>
<td width="4" style="width:3.0pt;padding:0in 0in 0in 0in"></td>
<td nowrap="" style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:13.5pt"><a href="https://www.youtube.com/channel/UC2GFE0sfAAiIeFaVYtYfnMA/videos" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.youtube.com/channel/UC2GFE0sfAAiIeFaVYtYfnMA/videos&source=gmail&ust=1650522310592000&usg=AOvVaw2fVOw7ydfzTMGyYRwsTwiz"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;border:none windowtext 1.0pt;padding:0in;text-decoration:none">
<img border="0" width="23" height="24" style="width:.243in;height:.25in" id="m_-6767754479392180719_x0000_i1028" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/icons/621fb6cdf1b76.jpg" alt=" " class="CToWUd"></span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
</td>
<td width="4" style="width:3.0pt;padding:0in 0in 0in 0in"></td>
<td nowrap="" style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:13.5pt"><a href="https://www.linkedin.com/company/consulting-engineers-south-africa/" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.linkedin.com/company/consulting-engineers-south-africa/&source=gmail&ust=1650522310592000&usg=AOvVaw1l9j9H4RDji5HEnIUNnEw9"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;border:none windowtext 1.0pt;padding:0in;text-decoration:none">
<img border="0" width="23" height="24" style="width:.243in;height:.25in" id="m_-6767754479392180719_x0000_i1027" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/icons/621fb6e2c9f82.jpg" alt=" " class="CToWUd"></span></a><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
</td>
<td width="4" style="width:3.0pt;padding:0in 0in 0in 0in"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:11.25pt">
<td style="padding:0in 0in 0in 0in;height:11.25pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="height:11.25pt">
<td style="padding:0in 0in 0in 0in;height:11.25pt"></td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:9.0pt"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#a1a1a1">This email is intended only for the person to whom it is addressed and/or otherwise authorized personnel or recipients. The information<br>
contained herein and attached is confidential and the property of the sender. Accessing confidential information of another without<br>
authorisation is prohibited in terms of law. <u></u><u></u></span></p>
</td>
</tr>
<tr style="height:11.25pt">
<td style="padding:0in 0in 0in 0in;height:11.25pt"></td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td width="14" style="width:10.5pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#a1a1a1">
<img border="0" width="10" height="10" style="width:.1041in;height:.1041in" id="m_-6767754479392180719_x0000_i1025" src="https://esr-storage.s3.amazonaws.com/images/20478/161905/icons/leaf-icon-sml.gif" alt=" " class="CToWUd"></span><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#a1a1a1"><u></u><u></u></span></p>
</td>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal" style="line-height:9.0pt"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#a1a1a1">Think before you print.
<u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="height:11.25pt">
<td style="padding:0in 0in 0in 0in;height:11.25pt"></td>
</tr>
<tr style="height:12.75pt">
<td style="padding:0in 0in 0in 0in;height:12.75pt"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>';
if ($id == 120) {
$sendto = "info@fidic-gama2018.com,andisiwe@aido.co.za,godfreyr@cesa.co.za,alymaah@aol.com,l.diallo@cira-sa.com";
$sendfrom = "info@fidic-gama2018.com";
$sOrgName = "FIDIC GAMA 2018";
$sContactEmail = "info@fidic-gama2018.com";
$sSubmitTo = "OICM";
$sEmailFooter = "";
?>
<!--<img src="/images/Fidic-Gama2018.png" hspace="10" align="left">
<img src="/images/icm.jpg" hspace="10" align="right">-->
<img src="/images/GAMA2018-Registration-Banner.png">
<?php
}
if ($id == 122) {
$sendto = "godfreyr@cesa.co.za";
$sendfrom = "godfreyr@cesa.co.za";
}
if ($id == 276) {
$sendto = "athromethm@cesa.co.za";
$sendfrom = "godfreyr@cesa.co.za";
}
if (!function_exists('GenPassword')) {
function GenPassword()
{
// Password generation
$length = 8; // Must be a multiple of 2
$conso = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z");
$vocal = array("a", "e", "i", "o", "u");
$password = "";
srand((int) (microtime(true) * 1_000_000));
$max = $length / 2;
for ($i = 1; $i <= $max; $i++) {
$password .= $conso[rand(0, 19)];
$password .= $vocal[rand(0, 4)];
}
return $password;
}
}
if (!function_exists('CaseCorrect')) {
function CaseCorrect($str)
{
$newstr = ucwords(strtolower($str));
return $newstr;
}
}
if (!function_exists('XMail')) {
function XMail($to, $subject, $msg, $from, $CC, $type, $sendBCC = true)
{
global $id, $db;
$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++) {
if (!empty($arrto[$i]))
$mail->AddAddress($arrto[$i]);
}
if ($sendBCC) {
if ($_POST["EventID"] == 120) {
$mail->AddBCC("godfreyr@cesa.co.za");
$mail->AddBCC("info@fidic-gama2018.com");
$mail->AddBCC("andisiwe@aido.co.za");
} else {
$sql = "SELECT AccountsEmail FROM MarketingEvents WHERE EventID=" . intval($_POST["EventID"]);
$recAE = mysql_query($sql);
if ($rowAE = mysql_fetch_assoc($recAE)) {
if (!empty($rowAE["AccountsEmail"])) {
$mail->AddBCC($rowAE["AccountsEmail"]);
} else {
$mail->AddBCC("athromethm@cesa.co.za");
}
}
if ($_POST["EventID"] == 122) {
$mail->AddBCC("godfreyr@cesa.co.za");
} else {
$mail->AddBCC("bonolo@cesa.co.za");
}
}
}
$mail->Subject = $subject;
$mail->Body = $msg;
if (!$mail->Send())
echo $mail->ErrorInfo;
}
}
?>
<link rel="stylesheet" href="/autosuggest/css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" src="/autosuggest/js/bsn.AutoSuggest_c_2.0.js"></script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php if (!$bMinimalRegForm) { ?>
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<?php } ?>
<SCRIPT LANGUAGE="JavaScript">
function IsEmpty(aTextField) {
if ((aTextField.value.length == 0) || (aTextField.value == null)) {
return true;
} else {
return false;
}
}
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 7;
function isInteger(s) {
var i;
for (i = 0; i < s.length; i++) {
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9")))
return false;
}
// All characters are numbers.
return true;
}
function stripCharsInBag(s, bag) {
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++) {
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1)
returnString += c;
}
return returnString;
}
function checkInternationalPhone(strPhone) {
s = stripCharsInBag(strPhone, validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function ValidateForm() {
var Phone = document.frmSample.txtPhone
if ((Phone.value == null) || (Phone.value == "")) {
alert("Please Enter your Phone Number")
Phone.focus()
return false
}
if (checkInternationalPhone(Phone.value) == false) {
alert("Please Enter a Valid Phone Number")
Phone.value = ""
Phone.focus()
return false
}
return true
}
// Field length constraints based on SchoolAttendees table structure
var fieldLengths = {
'Organisation': 255,
'CompanyType': 50,
'Address1': 255,
'Address2': 255,
'Address3': 255,
'City': 50,
'PostalCode': 20,
'OrderNumber': 50,
'VATNumber': 50,
'SAACEMemNum': 50,
'BookingName': 255,
'BookingTel': 50,
'BookingEmail': 255,
'BookingFax': 50,
'Designation': 50,
'FirstName': 30,
'Surname': 50,
'Tel': 50,
'Mobile': 50,
'Fax': 50,
'Email': 255,
'IDNumber': 50
};
function updateIdentityLabel(attendeeIndex) {
var form = document.forms['form1'];
if (!form) {
return;
}
var labelEl = document.getElementById('identityLabel' + attendeeIndex);
if (!labelEl) {
return;
}
var selected = 'SA ID';
var radios = form.elements['IdentityDocumentType' + attendeeIndex];
if (radios) {
if (radios.length) {
for (var r = 0; r < radios.length; r++) {
if (radios[r].checked) {
selected = radios[r].value;
}
}
} else if (radios.checked) {
selected = radios.value;
}
}
labelEl.textContent = (selected === 'Passport' ? 'Passport number' : 'South African ID number') + ':';
}
function updateIdentityFields(attendeeIndex) {
updateIdentityLabel(attendeeIndex);
updateDateOfBirthFromId(attendeeIndex);
}
function extractDateOfBirthFromSaId(idNumber) {
var id = String(idNumber || '').replace(/\s+/g, '');
if (!isValidSouthAfricanIdNumber(id)) {
return null;
}
var year = parseInt(id.substring(0, 2), 10);
var month = parseInt(id.substring(2, 4), 10);
var day = parseInt(id.substring(4, 6), 10);
var fullYear = 2000 + year;
var currentYear = new Date().getFullYear();
if (fullYear > currentYear) {
fullYear -= 100;
}
var testDate = new Date(fullYear, month - 1, day);
if (testDate.getFullYear() !== fullYear || testDate.getMonth() !== (month - 1) || testDate.getDate() !== day) {
return null;
}
return String(fullYear) + '-' + (month < 10 ? '0' : '') + month + '-' + (day < 10 ? '0' : '') + day;
}
function updateDateOfBirthFromId(attendeeIndex) {
var form = document.forms['form1'];
if (!form) {
return;
}
if (getSelectedIdentityDocumentType(form, attendeeIndex) !== 'SA ID') {
return;
}
var idField = form['IDNumber' + attendeeIndex];
var dobField = form['DateOfBirth' + attendeeIndex];
if (!idField || !dobField) {
return;
}
var dob = extractDateOfBirthFromSaId(idField.value);
if (dob) {
dobField.value = dob;
}
}
function isValidRegistrationDateOfBirth(value) {
var trimmed = String(value || '').trim();
if (trimmed === '') {
return false;
}
if (!/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
return false;
}
var parts = trimmed.split('-');
var year = parseInt(parts[0], 10);
var month = parseInt(parts[1], 10);
var day = parseInt(parts[2], 10);
var testDate = new Date(year, month - 1, day);
if (testDate.getFullYear() !== year || testDate.getMonth() !== (month - 1) || testDate.getDate() !== day) {
return false;
}
var today = new Date();
today.setHours(0, 0, 0, 0);
if (testDate > today) {
return false;
}
return true;
}
function getDateOfBirthValidationError(form, attendeeIndex) {
var dobField = form['DateOfBirth' + attendeeIndex];
if (!dobField) {
return null;
}
var prefix = 'Attendee ' + attendeeIndex + '\'s ';
var value = dobField.value || '';
if (String(value).trim() === '') {
return prefix + 'date of birth is required.';
}
if (!isValidRegistrationDateOfBirth(value)) {
return prefix + 'date of birth must be a valid date (YYYY-MM-DD) and cannot be in the future.';
}
return null;
}
function getSelectedIdentityDocumentType(form, attendeeIndex) {
var selected = 'SA ID';
var radios = form.elements['IdentityDocumentType' + attendeeIndex];
if (radios) {
if (radios.length) {
for (var r = 0; r < radios.length; r++) {
if (radios[r].checked) {
selected = radios[r].value;
}
}
} else if (radios.checked) {
selected = radios.value;
}
}
return selected;
}
function isValidSouthAfricanIdNumber(value) {
var id = String(value || '').replace(/\s+/g, '');
if (!/^\d{13}$/.test(id)) {
return false;
}
var val1 = 0;
var val2 = 0;
var i;
for (i = 0; i < 13; i += 2) {
val1 += parseInt(id.charAt(i), 10);
}
for (i = 1; i < 12; i += 2) {
var tmp = parseInt(id.charAt(i), 10) * 2;
if (tmp >= 10) {
tmp = (tmp - 10) + 1;
}
val2 += tmp;
}
return ((val1 + val2) % 10) === 0;
}
function isValidPassportNumber(value) {
var passport = String(value || '').replace(/\s+/g, '');
if (passport === '') {
return false;
}
return /^[A-Za-z0-9]{6,20}$/.test(passport);
}
function getIdentityNumberValidationError(form, attendeeIndex) {
var idField = form['IDNumber' + attendeeIndex];
if (!idField) {
return null;
}
var value = idField.value || '';
var selected = getSelectedIdentityDocumentType(form, attendeeIndex);
var prefix = 'Attendee ' + attendeeIndex + '\'s ';
if (String(value).replace(/\s+/g, '') === '') {
return prefix + (selected === 'Passport' ? 'Passport number is required.' : 'South African ID number is required.');
}
if (selected === 'Passport') {
if (!isValidPassportNumber(value)) {
return prefix + 'Passport number is not valid. Please enter 6 to 20 letters and numbers.';
}
return null;
}
if (!isValidSouthAfricanIdNumber(value)) {
return prefix + 'South African ID number is not valid. Please enter a valid 13-digit ID number.';
}
return null;
}
function checkFieldLength(fieldName, fieldValue, maxLength) {
if (fieldValue && fieldValue.length > maxLength) {
return 'Field "' + fieldName + '" exceeds maximum length of ' + maxLength + ' characters. Current length: ' + fieldValue.length + '. Please shorten the text.';
}
return null;
}
function validateFieldLengths(objForm) {
var errors = [];
// Validate organisation fields
if (objForm.Organisation && objForm.Organisation.value) {
var error = checkFieldLength('Organisation', objForm.Organisation.value, fieldLengths['Organisation']);
if (error) errors.push(error);
}
if (objForm.CompanyType && objForm.CompanyType.value) {
var error = checkFieldLength('Sector of Employment', objForm.CompanyType.value, fieldLengths['CompanyType']);
if (error) errors.push(error);
}
<?php if ($bShowFormInvoicing) { ?>
if (objForm.Address1 && objForm.Address1.value) {
var error = checkFieldLength('Address Line 1', objForm.Address1.value, fieldLengths['Address1']);
if (error) errors.push(error);
}
if (objForm.Address2 && objForm.Address2.value) {
var error = checkFieldLength('Address Line 2', objForm.Address2.value, fieldLengths['Address2']);
if (error) errors.push(error);
}
if (objForm.Address3 && objForm.Address3.value) {
var error = checkFieldLength('Address Line 3', objForm.Address3.value, fieldLengths['Address3']);
if (error) errors.push(error);
}
if (objForm.City && objForm.City.value) {
var error = checkFieldLength('City', objForm.City.value, fieldLengths['City']);
if (error) errors.push(error);
}
if (objForm.PostalCode && objForm.PostalCode.value) {
var error = checkFieldLength('Postal Code', objForm.PostalCode.value, fieldLengths['PostalCode']);
if (error) errors.push(error);
}
if (objForm.OrderNumber && objForm.OrderNumber.value) {
var error = checkFieldLength('Order Number', objForm.OrderNumber.value, fieldLengths['OrderNumber']);
if (error) errors.push(error);
}
if (objForm.VATNumber && objForm.VATNumber.value) {
var error = checkFieldLength('VAT Number', objForm.VATNumber.value, fieldLengths['VATNumber']);
if (error) errors.push(error);
}
if (objForm.SAACEMemNum && objForm.SAACEMemNum.value) {
var error = checkFieldLength('CESA Account Number', objForm.SAACEMemNum.value, fieldLengths['SAACEMemNum']);
if (error) errors.push(error);
}
<?php } ?>
<?php if ($bShowFormBooker) { ?>
if (objForm.BookingName && objForm.BookingName.value) {
var error = checkFieldLength('Booking Name', objForm.BookingName.value, fieldLengths['BookingName']);
if (error) errors.push(error);
}
if (objForm.BookingTel && objForm.BookingTel.value) {
var error = checkFieldLength('Booking Telephone', objForm.BookingTel.value, fieldLengths['BookingTel']);
if (error) errors.push(error);
}
if (objForm.BookingEmail && objForm.BookingEmail.value) {
var error = checkFieldLength('Booking Email', objForm.BookingEmail.value, fieldLengths['BookingEmail']);
if (error) errors.push(error);
}
if (objForm.BookingFax && objForm.BookingFax.value) {
var error = checkFieldLength('Booking Fax', objForm.BookingFax.value, fieldLengths['BookingFax']);
if (error) errors.push(error);
}
<?php } ?>
// Validate attendee fields
<?php for ($i = 1; $i <= 10; $i++) { ?>
if (objForm.DivDisplayed<?php echo $i; ?> && objForm.DivDisplayed<?php echo $i; ?>.value == 1) {
if (objForm.Designation<?php echo $i; ?> && objForm.Designation<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Designation', objForm.Designation<?php echo $i; ?>.value, fieldLengths['Designation']);
if (error) errors.push(error);
}
if (objForm.FirstName<?php echo $i; ?> && objForm.FirstName<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> First Name', objForm.FirstName<?php echo $i; ?>.value, fieldLengths['FirstName']);
if (error) errors.push(error);
}
if (objForm.Surname<?php echo $i; ?> && objForm.Surname<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Surname', objForm.Surname<?php echo $i; ?>.value, fieldLengths['Surname']);
if (error) errors.push(error);
}
if (objForm.Tel<?php echo $i; ?> && objForm.Tel<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Telephone', objForm.Tel<?php echo $i; ?>.value, fieldLengths['Tel']);
if (error) errors.push(error);
}
if (objForm.Mobile<?php echo $i; ?> && objForm.Mobile<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Mobile', objForm.Mobile<?php echo $i; ?>.value, fieldLengths['Mobile']);
if (error) errors.push(error);
}
if (objForm.Fax<?php echo $i; ?> && objForm.Fax<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Fax', objForm.Fax<?php echo $i; ?>.value, fieldLengths['Fax']);
if (error) errors.push(error);
}
if (objForm.Email<?php echo $i; ?> && objForm.Email<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> Email', objForm.Email<?php echo $i; ?>.value, fieldLengths['Email']);
if (error) errors.push(error);
}
if (objForm.IDNumber<?php echo $i; ?> && objForm.IDNumber<?php echo $i; ?>.value) {
var error = checkFieldLength('Attendee <?php echo $i; ?> identification number', objForm.IDNumber<?php echo $i; ?>.value, fieldLengths['IDNumber']);
if (error) errors.push(error);
}
<?php if (!$bMinimalRegForm) { ?>
var identityError<?php echo $i; ?> = getIdentityNumberValidationError(objForm, <?php echo $i; ?>);
if (identityError<?php echo $i; ?>) {
errors.push(identityError<?php echo $i; ?>);
}
var dobError<?php echo $i; ?> = getDateOfBirthValidationError(objForm, <?php echo $i; ?>);
if (dobError<?php echo $i; ?>) {
errors.push(dobError<?php echo $i; ?>);
}
<?php } ?>
}
<?php } ?>
if (errors.length > 0) {
alert('The following field length errors were found:\n\n' + errors.join('\n'));
return false;
}
return true;
}
function formCheck(objForm) {
bOK = true;
// First check field lengths
if (!validateFieldLengths(objForm)) {
return false;
}
if (IsEmpty(objForm.Organisation)) {
bOK = false;
alert('Please fill in your organisation.');
<?php
if ($bShowFormBooker) {
?>
} else if (IsEmpty(objForm.BookingName)) {
bOK = false;
alert('Please fill in your name.');
<?php
}
if ($bShowFormInvoicing) {
?>
} else if (IsEmpty(objForm.Address1)) {
bOK = false;
alert('Please fill in the address.');
} else if (IsEmpty(objForm.City)) {
bOK = false;
alert('Please fill in the city.');
} else if (IsEmpty(objForm.PostalCode)) {
bOK = false;
alert('Please fill in the postal code.');
<?php
}
?>
}
<?php
for ($i = 1; $i <= 10; $i++) {
?>
if (bOK && (objForm.DivDisplayed<?php echo $i; ?>.value == 1)) {
if (IsEmpty(objForm.Surname<?php echo $i; ?>)) {
bOK = false;
alert('Please fill in attendee <?php echo $i; ?>\'s surname.');
} else if (IsEmpty(objForm.FirstName<?php echo $i; ?>)) {
bOK = false;
alert('Please fill in attendee <?php echo $i; ?>\'s first name.');
} else if (IsEmpty(objForm.Tel<?php echo $i; ?>) && IsEmpty(objForm.Mobile<?php echo $i; ?>)) {
bOK = false;
alert('Please fill in attendee <?php echo $i; ?>\'s telephone number.');
} else {
bOK = emailCheck(objForm.Email<?php echo $i; ?>.value);
<?php if (!$bMinimalRegForm) { ?>
if (bOK) {
var identityError = getIdentityNumberValidationError(objForm, <?php echo $i; ?>);
if (identityError) {
bOK = false;
alert(identityError);
}
}
if (bOK) {
var dobError = getDateOfBirthValidationError(objForm, <?php echo $i; ?>);
if (dobError) {
bOK = false;
alert(dobError);
}
}
<?php } ?>
}
}
<?php
}
?>
/*
} else if (IsEmpty(objForm.OrderNumber)) {
bOK = false;
alert('Please fill in the order number.');
} else if ((checkInternationalPhone(objForm.Tel.value)==false) && (checkInternationalPhone(objForm.Mobile.value)==false)) {
bOK = false;
alert('Please provide a valid telephone number.');
} else if (!isInteger(objForm.PostalCode.value)) {
bOK = false;
alert('Please provide a numeric postal code.');
*/
return bOK;
}
function emailCheck(emailStr) {
return true;
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD. 1 means check it, 0 means don't. */
var checkTLD = 0;
/* The following is the list of known TLDs that an e-mail address must end with. */
var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
/* The following pattern is used to check if the entered e-mail address
fits the user@domain format. It also is used to separate the username
from the domain. */
var emailPat = /^(.+)@(.+)$/;
/* The following string represents the pattern for matching all special
characters. We don't want to allow special characters in the address.
These characters include ( ) < > @ , ; : \ " . [ ] */
var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
/* The following string represents the range of characters allowed in a
username or domainname. It really states which chars aren't allowed.*/
var validChars = "\[^\\s" + specialChars + "\]";
/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes). E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */
var quotedUser = "(\"[^\"]*\")";
/* The following pattern applies for domains that are IP addresses,
rather than symbolic names. E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */
var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
/* The following string represents an atom (basically a series of non-special characters.) */
var atom = validChars + '+';
/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */
var word = "(" + atom + "|" + quotedUser + ")";
// The following pattern describes the structure of the user
var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */
var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$");
/* Finally, let's start trying to figure out if the supplied address is valid. */
/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */
var matchArray = emailStr.match(emailPat);
if (matchArray == null) {
/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user = matchArray[1];
var domain = matchArray[2];
// Start by checking that only basic ASCII characters are in the strings (0-127).
for (i = 0; i < user.length; i++) {
if (user.charCodeAt(i) > 127) {
alert("The email address contains invalid characters.");
return false;
}
}
for (i = 0; i < domain.length; i++) {
if (domain.charCodeAt(i) > 127) {
alert("The email address contains invalid characters.");
return false;
}
}
// See if "user" is valid
if (user.match(userPat) == null) {
// user is not valid
alert("The email address doesn't seem to be valid.");
return false;
}
/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */
var IPArray = domain.match(ipDomainPat);
if (IPArray != null) {
// this is an IP address
for (var i = 1; i <= 4; i++) {
if (IPArray[i] > 255) {
alert("Destination IP address is invalid!");
return false;
}
}
return true;
}
// Domain is symbolic name. Check if it's valid.
var atomPat = new RegExp("^" + atom + "$");
var domArr = domain.split(".");
var len = domArr.length;
for (i = 0; i < len; i++) {
if (domArr[i].search(atomPat) == -1) {
alert("The email address does not seem to be valid.");
return false;
}
}
/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding
the domain or country. */
if (checkTLD && domArr[domArr.length - 1].length != 2 &&
domArr[domArr.length - 1].search(knownDomsPat) == -1) {
alert("The email address must end in a well-known domain or two letter " + "country.");
return false;
}
// Make sure there's a host name preceding the domain.
if (len < 2) {
alert("The email address is missing a hostname!");
return false;
}
// If we've gotten this far, everything's valid!
return true;
}
</script>
<?php
$db = mysql_connect(EW_CONN_HOST, EW_CONN_USER, EW_CONN_PASS);
mysql_select_db(EW_CONN_DB, $db);
$sql = "SELECT MarketingEvents.EventName, MarketingEvents.Level,
MarketingEvents.City, MarketingEvents.Venue, MarketingEvents.AllowRegDuring,
MarketingEvents.AvailableSpaces, MarketingEvents.CostPerPerson, MarketingEvents.EventDescription, MarketingEvents.Hours, MarketingEvents.CPD, MarketingEvents.CODE, MarketingEvents.AccredNum, MarketingEvents.Province, MarketingEvents.RegDeadline,
MarketingEvents.MemberDiscount, MarketingEvents.EarlyBirdDiscount, MarketingEvents.Cancelled, MarketingEvents.BankAccName, MarketingEvents.StartDate, MarketingEvents.EndDate, MarketingEvents.StartTime, MarketingEvents.EndTime, MarketingEvents.ExternalLink,
MarketingEvents.RegFormPersonal, MarketingEvents.RegFormCompany, MarketingEvents.RegFormSpouse,
MarketingEvents.RegFormBooker, MarketingEvents.RegFormInvoicing, MarketingEvents.RegFormDietary,
MarketingEvents.RegFormExhibitor, MarketingEvents.RegFormDinner, MarketingEvents.RegFormInfo, MarketingEvents.MinimalRegForm,
MarketingEvents.ConfirmationDetails, MarketingEvents.BannerImgURL, MarketingEvents.SponsorName
FROM MarketingEvents
WHERE MarketingEvents.EventID=" . $id;
//echo 'Please ignore debug info: ' . $sql . '<br />';
$queryresult = mysql_query($sql) or die();
if ($row = mysql_fetch_array($queryresult)) {
$ScheduleDates = '';
$copExtra = false;
try {
$copExtra = mysql_query(
'SELECT ChooseOnlineInPerson FROM MarketingEvents WHERE EventID=' . intval($id) . ' LIMIT 1'
);
} catch (\Throwable $e) {
}
if ($copExtra !== false && ($copRow = mysql_fetch_assoc($copExtra))) {
$row['ChooseOnlineInPerson'] = $copRow['ChooseOnlineInPerson'];
}
$copZoom = false;
try {
$copZoom = mysql_query(
'SELECT ZoomURL FROM MarketingEvents WHERE EventID=' . intval($id) . ' LIMIT 1'
);
} catch (\Throwable $e) {
}
if ($copZoom !== false && ($copZoomRow = mysql_fetch_assoc($copZoom))) {
$row['ZoomURL'] = $copZoomRow['ZoomURL'];
}
$bShowFormPersonal = false;
$bShowFormCompany = false;
$bShowFormSpouse = false;
$bShowFormBooker = false;
$bShowFormInvoicing = false;
$bShowFormDietary = false;
$bShowFormExhibitor = false;
$bShowFormDinner = false;
$bMinimalRegForm = false;
$bZoomURL = false;
if ($row["RegFormPersonal"] == 1)
$bShowFormPersonal = true;
if ($row["RegFormCompany"] == 1)
$bShowFormCompany = true;
if ($row["RegFormSpouse"] == 1)
$bShowFormSpouse = true;
if ($row["RegFormBooker"] == 1)
$bShowFormBooker = true;
if ($row["RegFormInvoicing"] == 1)
$bShowFormInvoicing = true;
if ($row["RegFormDietary"] == 1)
$bShowFormDietary = true;
if ($row["RegFormExhibitor"] == 1)
$bShowFormExhibitor = true;
if ($row["RegFormDinner"] == 1)
$bShowFormDinner = true;
if ($row["MinimalRegForm"] == 1)
$bMinimalRegForm = true;
if (!empty($row["ZoomURL"]))
$bZoomURL = true;
$BannerImgURL = $row["BannerImgURL"];
// check the dates
$bEventInPast = false;
$StartDatePlusTime = date("Y-m-d", strtotime($row["StartDate"])) . " " . $row["StartTime"];
$ScheduleDates .= "<b>·</b>" . date("D j F Y", strtotime($row["StartDate"])) . " at " . $row["StartTime"] . "<BR><br>";
if ($row["AllowRegDuring"] == 1) {
$EndDatePlusTime = date("Y-m-d", strtotime($row["EndDate"])) . " " . $row["EndTime"];
//echo $EndDatePlusTime;
if (strtotime($EndDatePlusTime) < time())
$bEventInPast = true;
} elseif (strtotime($StartDatePlusTime) < time()) {
$bEventInPast = true;
}
// check that there are still available spaces
$iNumBooked = 0;
$sql2 = "SELECT count(*) AS NumBooked FROM MarketingAttendees WHERE Cancelled=0 AND EventID=" . $id;
$queryresult2 = mysql_query($sql2);
if ($row2 = mysql_fetch_array($queryresult2)) {
$iNumBooked = $row2["NumBooked"];
}
$bNoSpace = (($row["AvailableSpaces"] > 0) && ($iNumBooked >= $row["AvailableSpaces"]));
if ($bEventInPast || $bNoSpace || ($row["Cancelled"] == 1)) {
// No space left
echo "<b><center>Registrations have now closed for this event, please contact " . $sOrgName . " (" . $sContactEmail . ") for more information.</center></b>";
} else {
$bShowForm = true;
if (isset($_POST["ProcessForm"]) && ($_POST["ProcessForm"] == 1)) {
// Notify system admin of registration attempt with all form data (before form data is checked)
$eventName = isset($row["EventName"]) ? $row["EventName"] : 'Event ID ' . intval($_POST["EventID"]);
$adminMsg = "<p><b>Event registration attempt</b></p>";
$adminMsg .= "<p><b>Event:</b> " . htmlspecialchars($eventName) . "<br><b>Event ID:</b> " . intval($id) . "<br><b>Submitted:</b> " . date('Y-m-d H:i:s') . "</p>";
$adminMsg .= "<p><b>Form data submitted:</b></p><table border=\"1\" cellpadding=\"6\" cellspacing=\"0\" style=\"border-collapse:collapse;font-size:12px;\">";
$adminMsg .= "<tr style=\"background:#e8e8e8;\"><th>Field</th><th>Value</th></tr>";
foreach ($_POST as $k => $v) {
if ($k === 'g-recaptcha-response') {
$v = $v ? '[submitted]' : '[empty]';
} else {
$v = is_string($v) ? htmlspecialchars($v) : print_r($v, true);
}
$adminMsg .= "<tr><td>" . htmlspecialchars($k) . "</td><td>" . $v . "</td></tr>";
}
$adminMsg .= "</table>";
maill($Notify, "Marketing Event registration attempt: " . $eventName, $adminMsg, null, array('isHTML' => true, 'from-address' => $sendfrom, 'from-name' => 'CESA Events'));
$EventID = $_POST["EventID"];
$Organisation = $_POST["Organisation"];
$CompanyType = $_POST["CompanyType"];
$Address1 = $_POST["Address1"];
$Address2 = $_POST["Address2"];
$Address3 = $_POST["Address3"];
$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"];
$Exhibitor = 0;
if (isset($_POST["Exhibitor"]) && ($_POST["Exhibitor"] == 1))
$Exhibitor = 1;
$Media = 0;
if (isset($_POST["Media"]) && ($_POST["Media"] == 1))
$Media = 1;
$Dinner = 0;
if (isset($_POST["Dinner"]) && ($_POST["Dinner"] == 1))
$Dinner = 1;
$JoinViaZoom = isset($_POST['JoinViaZoom']) ? (int) $_POST['JoinViaZoom'] : 0;
// Field length constraints based on SchoolAttendees table structure
$fieldLengths = array(
'Organisation' => 255, // CompanyName
'CompanyType' => 50,
'Address1' => 255, // AddressLine1
'Address2' => 255, // AddressLine2
'Address3' => 255, // AddressLine3
'City' => 50,
'PostalCode' => 20,
'OrderNumber' => 50, // OrderNum
'VATNumber' => 50, // OrgVATNum
'SAACEMemNum' => 50, // SAACEMemNumber
'BookingName' => 255,
'BookingTel' => 50,
'BookingEmail' => 255,
'BookingFax' => 50,
'Designation' => 50,
'FirstName' => 30, // ContactFirstName
'Surname' => 50, // ContactLastName
'Tel' => 50, // PhoneNumber
'Mobile' => 50, // MobileNumber
'Fax' => 50, // FaxNumber
'Email' => 255, // EmailAddress
'IDNumber' => 50
);
if (!function_exists('validateFieldLength')) {
function validateFieldLength($fieldName, $fieldValue, $maxLength) {
if ($fieldValue && strlen($fieldValue) > $maxLength) {
return "Field \"$fieldName\" exceeds maximum length of $maxLength characters. Current length: " . strlen($fieldValue) . ". Please shorten the text.";
}
return null;
}
}
$bFormErrors = false;
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.";
} else {
// Validate field lengths
$lengthError = validateFieldLength('Organisation', $Organisation, $fieldLengths['Organisation']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
if (!empty($CompanyType)) {
$lengthError = validateFieldLength('Sector of Employment', $CompanyType, $fieldLengths['CompanyType']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if ($bShowFormInvoicing) {
$lengthError = validateFieldLength('Address Line 1', $Address1, $fieldLengths['Address1']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
if (!empty($Address2)) {
$lengthError = validateFieldLength('Address Line 2', $Address2, $fieldLengths['Address2']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($Address3)) {
$lengthError = validateFieldLength('Address Line 3', $Address3, $fieldLengths['Address3']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
$lengthError = validateFieldLength('City', $City, $fieldLengths['City']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
$lengthError = validateFieldLength('Postal Code', $PostalCode, $fieldLengths['PostalCode']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
if (!empty($OrderNumber)) {
$lengthError = validateFieldLength('Order Number', $OrderNumber, $fieldLengths['OrderNumber']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($VATNumber)) {
$lengthError = validateFieldLength('VAT Number', $VATNumber, $fieldLengths['VATNumber']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($SAACEMemNum)) {
$lengthError = validateFieldLength('CESA Account Number', $SAACEMemNum, $fieldLengths['SAACEMemNum']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
}
if ($bShowFormBooker) {
if (!empty($BookingName)) {
$lengthError = validateFieldLength('Booking Name', $BookingName, $fieldLengths['BookingName']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($BookingTel)) {
$lengthError = validateFieldLength('Booking Telephone', $BookingTel, $fieldLengths['BookingTel']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($BookingEmail)) {
$lengthError = validateFieldLength('Booking Email', $BookingEmail, $fieldLengths['BookingEmail']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($BookingFax)) {
$lengthError = validateFieldLength('Booking Fax', $BookingFax, $fieldLengths['BookingFax']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
}
if (empty($Organisation)) {
$bFormErrors = true;
$sError[] = "Your organisation is required.";
}
if ($bShowFormInvoicing && empty($Address1)) {
$bFormErrors = true;
$sError[] = "Your address is required.";
}
$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["Email" . $i])) {
$bFormErrors = true;
$sError[] = "Attendee " . $i . "'s email address is required.";
}
// Validate attendee field lengths (and identity/DOB) for displayed or named attendees
for ($i = 1; $i <= 10; $i++) {
if ((isset($_POST["DivDisplayed" . $i]) && $_POST["DivDisplayed" . $i] == 1)
|| !empty($_POST["FirstName" . $i])) {
if (!empty($_POST["Designation" . $i])) {
$lengthError = validateFieldLength("Attendee $i Designation", $_POST["Designation" . $i], $fieldLengths['Designation']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["FirstName" . $i])) {
$lengthError = validateFieldLength("Attendee $i First Name", $_POST["FirstName" . $i], $fieldLengths['FirstName']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["Surname" . $i])) {
$lengthError = validateFieldLength("Attendee $i Surname", $_POST["Surname" . $i], $fieldLengths['Surname']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["Tel" . $i])) {
$lengthError = validateFieldLength("Attendee $i Telephone", $_POST["Tel" . $i], $fieldLengths['Tel']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["Mobile" . $i])) {
$lengthError = validateFieldLength("Attendee $i Mobile", $_POST["Mobile" . $i], $fieldLengths['Mobile']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["Fax" . $i])) {
$lengthError = validateFieldLength("Attendee $i Fax", $_POST["Fax" . $i], $fieldLengths['Fax']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["Email" . $i])) {
$lengthError = validateFieldLength("Attendee $i Email", $_POST["Email" . $i], $fieldLengths['Email']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!empty($_POST["IDNumber" . $i])) {
$lengthError = validateFieldLength("Attendee $i identification number", $_POST["IDNumber" . $i], $fieldLengths['IDNumber']);
if ($lengthError) {
$bFormErrors = true;
$sError[] = $lengthError;
}
}
if (!$bMinimalRegForm) {
$identityError = $marketingAttendeeObj->validateRegistrationIdentityNumber(
$_POST["IdentityDocumentType" . $i] ?? MarketingAttendees::IDENTITY_TYPE_SA_ID,
$_POST["IDNumber" . $i] ?? '',
$i
);
if ($identityError !== null) {
$bFormErrors = true;
$sError[] = $identityError;
}
$dobError = $marketingAttendeeObj->validateRegistrationDateOfBirth($_POST["DateOfBirth" . $i] ?? '', $i);
if ($dobError !== null) {
$bFormErrors = true;
$sError[] = $dobError;
}
}
}
}
}
if (!$bFormErrors) {
// Save all the form fields
$logFirstName = mysql_real_escape_string((string) ($_POST['FirstName1'] ?? ''));
$logSurname = mysql_real_escape_string((string) ($_POST['Surname1'] ?? ''));
foreach ($_POST as $FieldName => $FieldValue) {
$sql = "INSERT INTO EventFormFields (EventID, FirstName, LastName, FieldName, FieldValue, DateCreated)
VALUES ('" . $id . "', '" . $logFirstName . "', '" . $logSurname . "', '" . $FieldName . "', '" . $FieldValue . "',
'" . date("Y-m-d H:i") . "')";
$queryresult = mysql_query($sql);
}
//Send the confirmation
//ini_set("SMTP", "SAACEMAIL");
$sql = "SELECT MarketingEvents.EventName, MarketingEvents.EventName, MarketingEvents.Level, MarketingEvents.City, MarketingEvents.Venue,
MarketingEvents.RegDeadline,
MarketingEvents.MemberDiscount, MarketingEvents.EarlyBirdDiscount, MarketingEvents.BankAccName,
MarketingEvents.AvailableSpaces, MarketingEvents.CostPerPerson,
MarketingEvents.Hours, MarketingEvents.CPD, MarketingEvents.CODE,
MarketingEvents.AccredNum, MarketingEvents.Province, StartDate, StartTime, EndTime,
EndDate, ConfirmationDetails
FROM MarketingEvents
WHERE MarketingEvents.EventID=" . $id;
$queryresult = mysql_query($sql);
if ($row = mysql_fetch_array($queryresult)) {
$CostPrice = $row["CostPerPerson"];
// Member Discount
if (!empty($row["MemberDiscount"]) && ($row["MemberDiscount"] > 0) && (!empty($SAACEMemNum))) {
$CostPrice = $row["CostPerPerson"] - $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);
}
$formmsgtop = '<html><head><style>
body, td, p {
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
}
</style></head><body>
<h1 align=center style="font-family:Arial;font-size:14px">' . $row["EventName"] . '</h1>
<table border=1 cellspacing=0 cellpadding=2 width=700 style="font-family:Arial;font-size:12px">
<tr>
<td valign=top> <p><b>Date</b></p></td>
<td valign=top> <p><b>Venue</b></p></td>
</tr>
<tr>
<td nowrap> <p align=center style=text-align:center>';
$formmsgtop .= "<b>·</b>" . date("D j F Y", strtotime($row["StartDate"])) . "<BR><br>";
$formmsgtop .= '</p></td>
<td>' . $row["Venue"] . '</td>
</tr>
</table>
<table width=700 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>
</tr>
<tr>
<td valign=top> <p>Sector:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $CompanyType . '</td>
</tr>
<tr>
<td valign=top> <p>Address:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Address1 . "<br>" . $Address2 . "<br>" . $Address3 . "<br>" . $City . "<br>" . $PostalCode . '</td>
</tr> ';
if ($bShowFormInvoicing) {
$formmsgtop .= '
<tr><td>Purchase order number:</td><td bgcolor=#FFFFFF>' . $_POST["OrderNumber"] . '</td></tr>
<tr><td>CESA account number:</td><td bgcolor=#FFFFFF>' . $_POST["SAACEMemNum"] . '</td></tr>
<tr><td>VAT number:</td><td bgcolor=#FFFFFF>' . $_POST["VATNumber"] . '</td></tr>';
}
if ($bShowFormDinner) {
$formmsgtop .= '
<tr><td>Gala dinner only?</td><td bgcolor=#FFFFFF>';
if (isset($_POST["Dinner"]) && ($_POST["Dinner"] == 1)) {
$formmsgtop .= "Yes";
} else {
$formmsgtop .= "No";
}
$formmsgtop .= '</td></tr>';
}
if ($bZoomURL) {
$formmsgtop .= '
<tr><td>Join via Zoom:</td><td bgcolor=#FFFFFF>' . (isset($_POST['JoinViaZoom']) && $_POST['JoinViaZoom'] == 1 ? "Yes" : "No") . '</td></tr>';
}
if ($bShowFormExhibitor) {
$formmsgtop .= '
<tr><td>Exhibitor?</td><td bgcolor=#FFFFFF>';
if (isset($_POST["Exhibitor"]) && ($_POST["Exhibitor"] == 1)) {
$formmsgtop .= "Yes";
} else {
$formmsgtop .= "No";
}
$formmsgtop .= '</td></tr>';
$formmsgtop .= '
<tr><td>Media?</td><td bgcolor=#FFFFFF>';
if (isset($_POST["Media"]) && ($_POST["Media"] == 1)) {
$formmsgtop .= "Yes";
} else {
$formmsgtop .= "No";
}
$formmsgtop .= '</td></tr>';
}
$formmsgtop .= '
</table> ';
if ($bShowFormBooker) {
$formmsgtop .= '<p style="font-family:Arial;font-size:12px"><b>Booking made by:</b></p>
<table width=700 border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style="font-family:Arial;font-size:12px; clear:both">
<tr>
<td valign=top> <p>Name:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $_POST["BookingName"] . '</td>
<td valign=top> <p>Tel:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $_POST["BookingTel"] . '</td>
</tr>
<tr>
<td valign=top> <p>Email:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $_POST["BookingEmail"] . '</td>
<td valign=top> <p>Fax:</p></td>
<td valign=top bgcolor=#FFFFFF>' . $_POST["BookingFax"] . '</td>
</tr>
</table>';
}
$formmsgtop .= '<p style="font-family:Arial;font-size:12px"><b>Attendee/s:</b></p>';
$iNumInserted = 0;
$iNumDuplicates = 0;
$iNumAttendeesSubmitted = 0;
$iNumInsertFailures = 0;
$aDuplicateAttendees = array();
$aInsertFailures = array();
$formmsg = "";
for ($i = 1; $i <= 10; $i++) {
if (isset($_POST["FirstName" . $i]) && !empty($_POST["FirstName" . $i])) {
$iNumAttendeesSubmitted++;
$Designation = $_POST["Designation" . $i];
$Title = $_POST["Title" . $i];
$FirstName = $_POST["FirstName" . $i];
$Surname = $_POST["Surname" . $i];
$Tel = $_POST["Tel" . $i];
$Mobile = $_POST["Mobile" . $i];
$Fax = $_POST["Fax" . $i];
$Email = $_POST["Email" . $i];
$DietaryReq = $_POST["DietaryReq" . $i];
$IdentityDocumentType = $marketingAttendeeObj->normalizeIdentityDocumentType($_POST["IdentityDocumentType" . $i] ?? MarketingAttendees::IDENTITY_TYPE_SA_ID);
$identityLabel = $marketingAttendeeObj->identityNumberFieldLabel($IdentityDocumentType);
$IDNumber = $_POST["IDNumber" . $i];
$DateOfBirth = '';
if (!$bMinimalRegForm) {
$DateOfBirth = $marketingAttendeeObj->resolveRegistrationDateOfBirthForSave(
$_POST["DateOfBirth" . $i] ?? '',
$IdentityDocumentType,
$IDNumber
);
}
$ECSANumber = $_POST["ECSANumber" . $i];
$SAICENumber = $_POST["SAICENumber" . $i];
$OnlineInPerson = $_POST["OnlineInPerson" . $i];
$bInserted = false;
// Try to correct case
$FirstName = CaseCorrect($FirstName);
$Surname = CaseCorrect($Surname);
//$KnownAs = CaseCorrect($KnownAs);
$KnownAs = $FirstName;
// Check for duplicates
$sql = "SELECT * FROM MarketingAttendees "
. "WHERE ContactFirstName='" . mysql_real_escape_string($FirstName) . "' "
. "AND ContactLastName='" . mysql_real_escape_string($Surname) . "' "
. "AND PhoneNumber='" . mysql_real_escape_string($Tel) . "' "
. "AND EmailAddress='" . mysql_real_escape_string($Email) . "' "
. "AND EventID=" . $id;
$queryresult = mysql_query($sql);
if ($queryrows = mysql_fetch_assoc($queryresult)) {
$iNumDuplicates++;
$aDuplicateAttendees[] = array(
'FirstName' => isset($queryrows['ContactFirstName']) ? $queryrows['ContactFirstName'] : $FirstName,
'Surname' => isset($queryrows['ContactLastName']) ? $queryrows['ContactLastName'] : $Surname,
'Email' => isset($queryrows['EmailAddress']) ? $queryrows['EmailAddress'] : $Email,
'DateRegistered' => isset($queryrows['DateBooked']) ? $queryrows['DateBooked'] : ''
);
} else {
$sPassword = GenPassword();
$bookinghtml = '<table width=700 border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style="font-family:Arial;font-size:12px;clear:both">
<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>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>Fax:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Fax . '</td><td valign=top> <p>E-mail:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Email . '</td></tr>
<tr>
<td valign=top> <p><b>' . htmlspecialchars($identityLabel, ENT_QUOTES, 'UTF-8') . ':</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . htmlspecialchars($IDNumber, ENT_QUOTES, 'UTF-8') . '</td></tr>';
if (!$bMinimalRegForm && $DateOfBirth !== '') {
$bookinghtml .= '<tr>
<td valign=top> <p><b>Date of birth:</b></p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . htmlspecialchars($DateOfBirth, ENT_QUOTES, 'UTF-8') . '</td></tr>';
}
$bookinghtml .= '<tr>
<td valign=top> <p><b>Dietary restrictions / allergies:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $DietaryReq . '</td></tr>
<tr>
<td valign=top> <p><b>Attending Online/ In Person:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $OnlineInPerson . '</td></tr>';
$sql = "SELECT * FROM MarketingExtraFields WHERE MarketingEventID=" . $id . " ORDER BY DisplayOrder, MarketingExtraFieldID";
$recE = mysql_query($sql);
while ($rowE = mysql_fetch_assoc($recE)) {
$bookinghtml .= '<tr><td>' . $rowE["FieldLabel"] . ':</td>
<td colspan="3" valign="top">' . $_REQUEST[$rowE["FieldName"] . $i] . '</td></tr>';
}
$bookinghtml .= '</table> ';
$dateOfBirthSqlColumn = '';
$dateOfBirthSqlValue = '';
if (!$bMinimalRegForm) {
$dateOfBirthSqlColumn = 'DateOfBirth, ';
$dateOfBirthSqlValue = $marketingAttendeeObj->sqlDateOfBirthLiteral($DateOfBirth) . ', ';
}
$sql = "INSERT INTO MarketingAttendees (ContactTitle, ContactFirstName, ContactLastName, CompanyName, AddressLine1, AddressLine2,
AddressLine3, City, PostalCode, PhoneNumber, MobileNumber, FaxNumber, EmailAddress, DietaryReq, EventID, Attended, OrderNum,
OrgVATNum, IDNumber, IdentityDocumentType, " . $dateOfBirthSqlColumn . "SAACEMemNumber, ECSANumber, SAICEMemNumber, Designation, BookingName, BookingTel, BookingFax, BookingEmail,
KnownAs, CompanyType, `Password`, Exhibitor, Media, DinnerOnly, DateBooked, BookingForm, Subscribed, SponsorSubscribed,
SocialMediaConsent, OnlineInPerson, JoinViaZoom)
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 . "',
'" . mysql_real_escape_string($Tel) . "', '" . mysql_real_escape_string($Mobile) . "', '" . mysql_real_escape_string($Fax) . "',
'" . mysql_real_escape_string($Email) . "', '" . mysql_real_escape_string($DietaryReq) . "', " . $id . ", 'u',
'" . mysql_real_escape_string($OrderNumber) . "', '" . mysql_real_escape_string($VATNumber) . "',
'" . mysql_real_escape_string($IDNumber) . "', '" . mysql_real_escape_string($IdentityDocumentType) . "',
" . $dateOfBirthSqlValue . "'" . mysql_real_escape_string($SAACEMemNum) . "',
'" . mysql_real_escape_string($ECSANumber) . "', '" . mysql_real_escape_string($SAICENumber) . "',
'" . mysql_real_escape_string($Designation) . "', '" . mysql_real_escape_string($BookingName) . "',
'" . mysql_real_escape_string($BookingTel) . "', '" . mysql_real_escape_string($BookingFax) . "',
'" . mysql_real_escape_string($BookingEmail) . "', '" . mysql_real_escape_string($KnownAs) . "',
'" . mysql_real_escape_string($CompanyType) . "', '" . $sPassword . "', '" . $Exhibitor . "', '" . $Media . "', '" . $Dinner . "',
'" . date("Y-m-d H:i:s") . "', '" . mysql_real_escape_string($formmsgtop . $bookinghtml) . "',
'" . mysql_real_escape_string((string) ($_POST['subscribe'] ?? '')) . "', '" . mysql_real_escape_string((string) ($_POST['sponsor_subscribe'] ?? '')) . "',
'" . mysql_real_escape_string((string) ($_POST['social_media_consent'] ?? '')) . "', '" . mysql_real_escape_string((string) ($OnlineInPerson ?? '')) . "',
" . ((int) $JoinViaZoom) . ")";
$queryresult = mysql_query($sql);
$iAttendeeID = mysql_insert_id();
if (!$queryresult) {
$iNumInsertFailures++;
$aInsertFailures[] = $marketingAttendeeObj->handleRegistrationInsertFailure(
$id,
$i,
array(
'firstName' => $FirstName,
'surname' => $Surname,
'email' => $Email,
),
mysql_error(get_current_connection()),
$sql
);
} else {
$bInserted = true;
$iNumInserted++;
$sql = "SELECT * FROM MarketingExtraFields WHERE MarketingEventID=" . $id . " ORDER BY DisplayOrder, MarketingExtraFieldID";
$recE = mysql_query($sql);
while ($rowE = mysql_fetch_assoc($recE)) {
$sql = "INSERT INTO MarketingExtraInfo (AttendeeID, FieldName, FieldValue) VALUES (" . $iAttendeeID . ", '" . $rowE["FieldName"] . "', '" . addslashes($_REQUEST[$rowE["FieldName"] . $i]) . "')";
mysql_query($sql);
}
$sql = "UPDATE MarketingAttendees, MarketingExtraFields, MarketingExtraInfo
SET MarketingAttendees.SeatsRequired=MarketingExtraInfo.FieldValue
WHERE MarketingAttendees.EventID=MarketingExtraFields.MarketingEventID
AND MarketingExtraFields.`FieldName`=MarketingExtraInfo.FieldName
AND MarketingExtraInfo.FieldName='Num_Seats' AND MarketingAttendees.`AttendeeID`=MarketingExtraInfo.`AttendeeID`
AND MarketingExtraInfo.FieldValue<>'' AND MarketingAttendees.AttendeeID=" . $iAttendeeID;
mysql_query($sql);
$sql = "UPDATE MarketingAttendees, MarketingExtraFields, MarketingExtraInfo
SET MarketingAttendees.TablesRequired=MarketingExtraInfo.FieldValue
WHERE MarketingAttendees.EventID=MarketingExtraFields.MarketingEventID
AND MarketingExtraFields.`FieldName`=MarketingExtraInfo.FieldName
AND MarketingExtraInfo.FieldName='Num_Tables' AND MarketingAttendees.`AttendeeID`=MarketingExtraInfo.`AttendeeID`
AND MarketingExtraInfo.FieldValue<>'' AND MarketingAttendees.AttendeeID=" . $iAttendeeID;
mysql_query($sql);
}
}
if ($bInserted) {
$FirstName = stripslashes($FirstName);
$Surname = stripslashes($Surname);
$CourseType = $row["Level"];
if (empty($CourseType))
$CourseType = "Course";
if ($EventID == 120) {
$msg = "<p>Dear " . $FirstName . " " . $Surname . ",</p>
<p>We are delighted to have received your online registration for 25 th Annual FIDIC-GAMA Conference
2018 to be held on Sun 6 May 2018 to Wed 9 May 2018, at LAICO L'AMITIE Hotel in Bamako.</p>
<p><b>Letter of Invitation</b></p>
<p>Please download and fill out all the required information on the <b>generic VISA Invitation Letter</b> and
email it back together with a <b>copy of your passport</b> to the Conference Organisers at info@fidic-gama2018.com</p>
<p><a href='https://www.cesa.co.za/uploads/OICM_Visa_Invitation_Letter.docx'>Letter of Invitation download</a></p>
<p><b>Bank account</b></p>
<p><a href='https://www.cesa.co.za/uploads/New_banking_information.pdf'>Bank Account download</a></p>
<p><b>Registrations and Inquiries</b></p>
<p>Alima Dabo – General Secretary of FIDIC-GAMA 2018<br>
Cell: +223 76 01 70 96 │ Email: info@fidic-gama2018.com</p>
<p>With kind regards,<br>
OICM</p>";
} else {
if (!empty($BannerImgURL)) {
$sEmailImg = $BannerImgURL;
} else {
$sEmailImg = "https://www.cesa.co.za/images/CESA_Confirmation_Bannner_1.jpg";
}
$msg = "<p><img src='" . $sEmailImg . "' width='620'></p><p>Dear " . $FirstName . " " . $Surname . ",</p>
<p>We are delighted to have received your online registration for " . $row["EventName"] . " to be held on " . date("D j F Y", strtotime($row["StartDate"]));
if ($row["StartDate"] != $row["EndDate"])
$msg .= " to " . date("D j F Y", strtotime($row["EndDate"]));
if (!empty($row["StartTime"])) {
$msg .= " at " . date("H:i", strtotime($row["StartTime"]));
if (!empty($row["EndTime"]))
$msg .= "-" . date("H:i", strtotime($row["EndTime"]));
}
if ($row["Venue"] == 'MS Teams') {
$msg .= ", on " . $row["Venue"] . ".</p>";
} else {
$msg .= ", at " . $row["Venue"] . ".</p>";
}
// $msg .= ".</p>";
$msg .= $row["ConfirmationDetails"];
$msg .= "<p>With kind regards,</p>
" . $sOrgName . "</p>" . $sEmailFooter;
}
// XMail($Email . "," . $BookingEmail, "Confirmation of " . $sOrgName . " Event Registration: " . $row["EventName"], "<html>
// <head>
// <style>
// body, td {
// font-family: Arial, Verdana, sans-serif;
// font-size: 11pt;
// }
// </style>
// </head>
// <body>" . $msg . "</body></html>", $sendfrom, "", "html", false);
$icsPath = null;
try {
$rowIcs = $marketingAttendeeObj->findById($iAttendeeID);
if (is_array($rowIcs) && count($rowIcs) > 0) {
$icsPath = $marketingAttendeeObj->getICSAttachmentFile($rowIcs);
}
} catch (\Throwable $e) {
// ICS attachment optional; ADODB/mysqli can fail on JOIN SELECT * under some drivers
}
maill(
$Email . "," . $BookingEmail,
"Confirmation of " . $sOrgName . " Event Registration: " . $row["EventName"],
"<html>
<head>
<style>
body, td {
font-family: Arial, Verdana, sans-serif;
font-size: 11pt;
}
</style>
</head>
<body>" . $msg . "</body></html>",
$icsPath,
array(
'isHTML' => true,
'from-address' => $sendfrom,
'from-name' => 'CESA Events',
'i-cal' => Mailer::getICalText($row, array(
'ContactFirstName' => $FirstName,
'ContactLastName' => $Surname,
'EmailAddress' => $Email,
))
)
);
$formmsg .= '<table width=700 border=1 cellpadding=2 cellspacing=0 bgcolor=#EFEFEF style="font-family:Arial;font-size:12px;clear:both">
<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>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>Fax:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Fax . '</td><td valign=top> <p>E-mail:
</p></td>
<td valign=top bgcolor=#FFFFFF>' . $Email . '</td></tr>
<tr>
<td valign=top> <p><b>' . htmlspecialchars($identityLabel, ENT_QUOTES, 'UTF-8') . ':</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . htmlspecialchars($IDNumber, ENT_QUOTES, 'UTF-8') . '</td></tr>';
if (!$bMinimalRegForm && $DateOfBirth !== '') {
$formmsg .= '<tr>
<td valign=top> <p><b>Date of birth:</b></p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . htmlspecialchars($DateOfBirth, ENT_QUOTES, 'UTF-8') . '</td></tr>';
}
$formmsg .= '<tr>
<td valign=top> <p><b>Dietary restrictions / allergies:</b>
</p></td>
<td colspan=3 valign=top bgcolor=#FFFFFF>' . $DietaryReq . '</td></tr> ';
$sql = "SELECT * FROM MarketingExtraFields WHERE MarketingEventID=" . $EventID . " ORDER BY DisplayOrder, MarketingExtraFieldID";
$recE = mysql_query($sql);
while ($rowE = mysql_fetch_assoc($recE)) {
$formmsg .= '<tr><td>' . $rowE["FieldLabel"] . ':</td>
<td colspan="3" valign="top">' . $_REQUEST[$rowE["FieldName"] . $i] . '</td></tr>';
}
$formmsg .= '
</table> ';
}
}
}
if ($iNumInserted == 0) {
$noAttendeesSummary = $marketingAttendeeObj->buildNoAttendeesRegisteredSummary(array(
'submittedCount' => $iNumAttendeesSubmitted,
'duplicateCount' => $iNumDuplicates,
'insertFailureCount' => $iNumInsertFailures,
'insertFailures' => $aInsertFailures,
));
?>
<p><b><?php echo htmlspecialchars($noAttendeesSummary['heading'], ENT_QUOTES, 'UTF-8'); ?></b></p>
<p><?php echo htmlspecialchars($noAttendeesSummary['detail'], ENT_QUOTES, 'UTF-8'); ?></p>
<?php
if (count($aInsertFailures) > 0) {
echo '<p><b>The following registration error(s) occurred:</b></p>';
echo '<table border="1" cellpadding="8" cellspacing="0" style="border-collapse:collapse;font-family:Arial;font-size:12px;margin-top:8px;">';
echo '<thead><tr style="background:#e8e8e8;"><th>Attendee</th><th>Name</th><th>E-mail</th><th>Error</th></tr></thead><tbody>';
foreach ($aInsertFailures as $failure) {
echo '<tr>';
echo '<td>' . htmlspecialchars((string) ($failure['attendeeNumber'] ?? '')) . '</td>';
echo '<td>' . htmlspecialchars(trim(($failure['firstName'] ?? '') . ' ' . ($failure['surname'] ?? ''))) . '</td>';
echo '<td>' . htmlspecialchars((string) ($failure['email'] ?? '')) . '</td>';
echo '<td>' . htmlspecialchars((string) ($failure['displayError'] ?? '')) . '</td>';
echo '</tr>';
}
echo '</tbody></table>';
}
if ($iNumDuplicates > 0) {
echo "<p><b>" . $iNumDuplicates
. " duplicate(s) were found. The following attendees have already been registered for this event:</b></p>";
echo '<table border="1" cellpadding="8" cellspacing="0" style="border-collapse:collapse;font-family:Arial;font-size:12px;margin-top:8px;">';
echo '<thead><tr style="background:#e8e8e8;"><th>Name</th><th>Surname</th><th>E-mail</th><th>Date registered</th></tr></thead><tbody>';
foreach ($aDuplicateAttendees as $dup) {
$regDate = !empty($dup['DateRegistered']) ? date('d M Y H:i', strtotime($dup['DateRegistered'])) : '—';
echo '<tr>';
echo '<td>' . htmlspecialchars($dup['FirstName']) . '</td>';
echo '<td>' . htmlspecialchars($dup['Surname']) . '</td>';
echo '<td>' . htmlspecialchars($dup['Email']) . '</td>';
echo '<td>' . $regDate . '</td>';
echo '</tr>';
}
echo '</tbody></table>';
}
} else {
// XMail($sendto, "Marketing Event Registration from Website", $formmsgtop . $formmsg, $sendfrom, "", "html");
maill($sendto, "Marketing Event Registration from Website", $formmsgtop . $formmsg, null, array('isHTML' => true, 'from-address' => $sendfrom, 'from-name' => 'CESA Events'));
?>
<p align="center" style="font-size:20px"><i><b>Thank you for your RSVP</b></i></p>
<p align="center">We look forward to welcoming you to this event.</p>
<p align="center">If you have any queries, please contact <?php echo $sOrgName; ?> on <?php echo $sContactEmail; ?>.</p>
<?php
echo $row["ConfirmationDetails"];
}
}
}
if (!$bFormErrors)
$bShowForm = false;
}
if ($bShowForm) {
if (!empty($BannerImgURL)) {
echo '<p align="center"><img src="' . $BannerImgURL . '" style="height:auto; max-height:150px; max-width:100%"></p>';
}
?>
<h1 align="center"><?php echo $row["EventName"]; ?></h1>
<?php
echo "<p align='center'><b>" . date("d F Y", strtotime($row["StartDate"]));
if (!empty($row["EndDate"]) && (strtotime($row["StartDate"]) != strtotime($row["EndDate"])))
echo " to " . date("d F Y", strtotime($row["EndDate"]));
if (!empty($row["StartTime"])) {
echo " at " . date("H:i", strtotime($row["StartTime"]));
if (!empty($row["EndTime"]))
echo "-" . date("H:i", strtotime($row["EndTime"]));
}
echo "</b></p>";
if (!empty($row["Venue"]))
echo "<p align='center'><i>" . $row["Venue"] . "</i></p>";
if ($bFormErrors) {
echo "<p><font color=red><b>The following errors occurred:</b></font><br>" . join("<br>", $sError) . "<br><b>Please correct the errors and submit again. Thank you!</b></p>";
}
if (!empty($row["ExternalLink"]))
echo "<p align=center><b style='font-size:14px'><a href='" . $row["ExternalLink"] . "' target='_blank'>Click here for more information about this event</a></b></p>";
if ($id != 120) {
?>
<p align=center style='text-align:center'><b>Please fill in the form, and then press the Submit button to send it to <?php echo $sSubmitTo; ?>.</b></p>
<?php
}
?>
<form name="form1" method="post" action="<?php echo $submitformto; ?>" onSubmit="return formCheck(this)">
<input type="hidden" name="ProcessForm" value="1">
<input type="hidden" name="EventID" value="<? echo $id; ?>">
<input type="hidden" name="id" value="<? echo $id; ?>">
<table width=760 border=1 cellpadding=2 cellspacing=0 bgcolor="#EFEFEF">
<?php ?>
<tr>
<td width="28%" valign=top bgcolor="#EFEFEF">
<p><strong>Your Company / Organisation: </strong></p>
</td>
<td width="72%" valign=top><input name="Organisation" id="Organisation" type="text" size="45" value="<?php echo stripslashes($_POST["Organisation"] . ""); ?>" required></td>
</tr>
<tr>
<td width="28%" valign=top bgcolor="#EFEFEF">
<p><strong>Sector of Employment: </strong></p>
</td>
<td width="72%" valign=top><select name="CompanyType" id="CompanyType" required>
<option value="">Please select</option>
<option value="Consulting Engineering - CESA Member" <?php if ($_POST["CompanyType"] == "Consulting Engineering - CESA Member") echo " selected"; ?>>Consulting Engineering - CESA Member</option>
<option value="Consulting Engineering - Not a CESA Member" <?php if ($_POST["CompanyType"] == "Consulting Engineering - Not a CESA Member") echo " selected"; ?>>Consulting Engineering - Not a CESA Member</option>
<option value="Government" <?php if ($_POST["CompanyType"] == "Government") echo " selected"; ?>>Government</option>
<option value="SOE" <?php if ($_POST["CompanyType"] == "SOE") echo " selected"; ?>>SOE</option>
<option value="Contractor" <?php if ($_POST["CompanyType"] == "Contractor") echo " selected"; ?>>Contractor</option>
<option value="Supplier" <?php if ($_POST["CompanyType"] == "Supplier") echo " selected"; ?>>Supplier</option>
<option value="Developer/Financier" <?php if ($_POST["CompanyType"] == "Developer/Financier") echo " selected"; ?>>Developer/Financier</option>
<option value="Insurance broker/Insurer" <?php if ($_POST["CompanyType"] == "Insurance broker/Insurer") echo " selected"; ?>>Insurance broker/Insurer</option>
<option value="Academia" <?php if ($_POST["CompanyType"] == "Academia") echo " selected"; ?>>Academia</option>
<option value="Student" <?php if ($_POST["CompanyType"] == "Student") echo " selected"; ?>>Student</option>
<option value="Other" <?php if ($_POST["CompanyType"] == "Other") echo " selected"; ?>>Other</option>
</select>
</tr>
<?php
if ($bShowFormInvoicing || $bShowFormCompany) {
?>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>Postal Address:</p>
</td>
<td valign=top><input name="Address1" type="text" size="50" value="<?php echo stripslashes($_POST["Address1"] . ""); ?>"></td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p> </p>
</td>
<td valign=top><input name="Address2" type="text" size="50" value="<?php echo stripslashes($_POST["Address2"] . ""); ?>"> </td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p> </p>
</td>
<td valign=top><input name="Address3" type="text" size="50" value="<?php echo stripslashes($_POST["Address3"] . ""); ?>"> </td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>City: </p>
</td>
<td valign=top><input name="City" type="text" size="30" value="<?php echo stripslashes($_POST["City"] . ""); ?>"> </td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>Postal code: </p>
</td>
<td valign=top><input name="PostalCode" type="text" size="30" value="<?php echo $_POST["PostalCode"]; ?>"></td>
</tr>
<?php
}
if ($bShowFormInvoicing) {
?>
<tr>
<td valign=top>Purchase order number:</td>
<td valign=top nowrap><input name="OrderNumber" type="text" size="30" value="<?php echo $_POST["OrderNumber"]; ?>">
if available</td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">CESA
Account number:</td>
<td valign=top><input name="SAACEMemNum" type="text" size="30" id="SAACEMemNum" value="<?php echo $_POST["SAACEMemNum"]; ?>">
if applicable</td>
</tr>
<tr>
<td valign=top>VAT number: </td>
<td valign=top nowrap><input name="VATNumber" type="text" size="30" value="<?php echo $_POST["VATNumber"]; ?>"></td>
</tr>
<?php
}
if ($bShowFormDinner) {
?>
<tr>
<td valign=top>Are you registering for the gala dinner <b>only</b>? Cost: R855.00 (incl. VAT)</td>
<td valign=top nowrap><input type="radio" name="Dinner" value="1" <?php if ($_POST["Dinner"] == 1) echo " checked"; ?>>Yes <input type="radio" name="Dinner" value="0" <?php if (!isset($_POST["Dinner"]) || ($_POST["Dinner"] == 0)) echo " checked"; ?>>No</td>
</tr>
<?php
}
if ($bZoomURL) {
?>
<tr>
<td valign=top>Join via Zoom?</td>
<td valign=top nowrap>
<input type="radio" name="JoinViaZoom" value="1" <?php if ($_POST["JoinViaZoom"] == 1) echo " checked"; ?>>Yes
<input type="radio" name="JoinViaZoom" value="0"
<?php if (!isset($_POST["JoinViaZoom"]) || ($_POST["JoinViaZoom"] == 0)) echo " checked"; ?>>No
</td>
</tr>
<?php
}
if ($bShowFormExhibitor) {
?>
<tr>
<td valign=top>Are you an exhibitor? </td>
<td valign=top nowrap><input type="radio" name="Exhibitor" value="1" <?php if ($_POST["Exhibitor"] == 1) echo " checked"; ?>>Yes <input type="radio" name="Exhibitor" value="0" <?php if (!isset($_POST["Exhibitor"]) || ($_POST["Exhibitor"] == 0)) echo " checked"; ?>>No</td>
</tr>
<tr>
<td valign=top>Are you an authorised media representative? </td>
<td valign=top nowrap><input type="radio" name="Media" value="1" <?php if ($_POST["Media"] == 1) echo " checked"; ?>>Yes <input type="radio" name="Media" value="0" <?php if (!isset($_POST["Media"]) || ($_POST["Media"] == 0)) echo " checked"; ?>>No</td>
</tr>
<?php
}
?>
</table>
<?php
if ($bShowFormBooker) {
?>
<table width=760 border=1 cellpadding=2 cellspacing=0 bgcolor="#EFEFEF">
<tr>
<td colspan="2" valign=top bgcolor="#EFEFEF"><strong>Booking made by:</strong></td>
<td valign=top> </td>
<td valign=top> </td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">Your name:</td>
<td valign=top><input name="BookingName" type="text" size="40" id="BookingName" value="<?php echo stripslashes($_POST["BookingName"] . ""); ?>"></td>
<td valign=top>Telephone:</td>
<td valign=top><input name="BookingTel" type="text" size="30" id="BookingTel" value="<?php echo $_POST["BookingTel"]; ?>"></td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">Your email:</td>
<td valign=top><input name="BookingEmail" type="text" size="30" id="BookingEmail" value="<?php echo $_POST["BookingEmail"]; ?>"></td>
<td valign=top>Fax:</td>
<td valign=top><input name="BookingFax" type="text" size="30" id="BookingFax" value="<?php echo $_POST["BookingFax"]; ?>"></td>
</tr>
</table>
<?php
}
?>
<p> </p>
<p><b>Attendees</b></p>
<p>To add more attendees, click the "Add Another
Attendee" button.</p>
<?php
for ($i = 1; $i <= 10; $i++) {
$ShowThisDiv = 0;
if ($i == 1)
$ShowThisDiv = 1;
if (($_POST["DivDisplayed" . $i] ?? "") == "1")
$ShowThisDiv = 1;
echo '<div id="candidate' . $i . '" style="display:' . ($ShowThisDiv == 0 ? "none" : "") . '">';
?>
<input type="hidden" name="DivDisplayed<?php echo $i; ?>" id="DivDisplayed<?php echo $i; ?>" value="<?php echo $ShowThisDiv; ?>">
<table width=760 border=1 cellpadding=2 cellspacing=0 bgcolor="#EFEFEF">
<?php if (!$bMinimalRegForm) { ?>
<tr>
<td width="16%" valign=top bgcolor="#EFEFEF">
<p>Title:</p>
</td>
<td width="25%" valign=top>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap>Prof.<input type="radio" name="Title<?php echo $i; ?>" value="Prof"></td>
<td nowrap style="padding:0px 10px 0px 5px">Dr.<input type="radio" name="Title<?php echo $i; ?>" value="Dr" <?php if (($_POST["Title" . $i] ?? '') == "Dr") echo " checked"; ?>></td>
<td nowrap style="padding:0px 10px 0px 5px">Mr.<input name="Title<?php echo $i; ?>" type="radio" value="Mr" <?php if (!isset($_POST["Title" . $i]) || (($_POST["Title" . $i] ?? '') == "Mr")) echo " checked"; ?>></td>
</tr>
<tr>
<td nowrap style="padding:0px 10px 0px 5px">Mrs.
<input type="radio" name="Title<?php echo $i; ?>" value="Mrs" <?php if (($_POST["Title" . $i] ?? '') == "Mrs") echo " checked"; ?>>
</td>
<td nowrap style="padding:0px 0px 0px 5px">Ms.
<input type="radio" name="Title<?php echo $i; ?>" value="Ms" <?php if (($_POST["Title" . $i] ?? '') == "Ms") echo " checked"; ?>>
</td>
<td nowrap style="padding:0px 10px 0px 5px">Eng.
<input type="radio" name="Title<?php echo $i; ?>" value="Eng" <?php if (($_POST["Title" . $i] ?? '') == "Eng") echo " checked"; ?>>
</td>
</tr>
</table>
</td>
<td width="27%" valign=top>Designation:</td>
<td width="32%" valign=top><input name="Designation<?php echo $i; ?>" type="text" size="40" id="Designation<?php echo $i; ?>" value="<?php echo htmlspecialchars((string)(($_POST['Designation' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>">
(e.g. CEO, Managing Director, Personal Assistant etc)</td>
</tr>
<?php } ?>
<tr>
<td valign=top bgcolor="#EFEFEF">First Name:</td>
<td valign=top><input name="FirstName<?php echo $i; ?>" type="text" size="30" value="<?php echo stripslashes((string)(($_POST['FirstName' . $i] ?? ''))); ?>"></td>
<td valign=top>Surname:</td>
<td valign=top><input name="Surname<?php echo $i; ?>" type="text" size="40" value="<?php echo htmlspecialchars((string)(($_POST['Surname' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>"></td>
</tr>
<?php if (!$bMinimalRegForm) {
$identityType = $marketingAttendeeObj->normalizeIdentityDocumentType($_POST['IdentityDocumentType' . $i] ?? MarketingAttendees::IDENTITY_TYPE_SA_ID);
$identityLabel = $marketingAttendeeObj->identityNumberFieldLabel($identityType);
$dateOfBirthValue = $marketingAttendeeObj->formatRegistrationDateOfBirthForDisplay($_POST['DateOfBirth' . $i] ?? '');
if ($dateOfBirthValue === '' && $identityType === MarketingAttendees::IDENTITY_TYPE_SA_ID) {
$extractedDob = $marketingAttendeeObj->extractDateOfBirthFromSouthAfricanId($_POST['IDNumber' . $i] ?? '');
if ($extractedDob !== null) {
$dateOfBirthValue = $extractedDob;
}
}
?>
<tr>
<td valign=top bgcolor="#EFEFEF">Identification:</td>
<td valign=top colspan=3>
<label style="margin-right:1em;">
<input type="radio" name="IdentityDocumentType<?php echo $i; ?>" value="SA ID"<?php echo ($identityType === MarketingAttendees::IDENTITY_TYPE_SA_ID) ? ' checked="checked"' : ''; ?> onclick="updateIdentityFields(<?php echo $i; ?>);">
South African ID number
</label>
<label>
<input type="radio" name="IdentityDocumentType<?php echo $i; ?>" value="Passport"<?php echo ($identityType === MarketingAttendees::IDENTITY_TYPE_PASSPORT) ? ' checked="checked"' : ''; ?> onclick="updateIdentityFields(<?php echo $i; ?>);">
Passport number
</label>
</td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF"><span id="identityLabel<?php echo $i; ?>"><?php echo htmlspecialchars($identityLabel, ENT_QUOTES, 'UTF-8'); ?>:</span></td>
<td valign=top colspan=3><input name="IDNumber<?php echo $i; ?>" type="text" size="30" value="<?php echo stripslashes((string)(($_POST['IDNumber' . $i] ?? ''))); ?>" onblur="updateDateOfBirthFromId(<?php echo $i; ?>);"></td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">Date of birth:</td>
<td valign=top colspan=3>
<input name="DateOfBirth<?php echo $i; ?>" id="DateOfBirth<?php echo $i; ?>" type="text" size="12" class="marketing-event-dob" placeholder="YYYY-MM-DD" value="<?php echo htmlspecialchars($dateOfBirthValue, ENT_QUOTES, 'UTF-8'); ?>">
</td>
</tr>
<?php
}
if ($bShowFormPersonal) {
?>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>Telephone: </p>
</td>
<td valign=top><input name="Tel<?php echo $i; ?>" type="text" size="30" value="<?php echo htmlspecialchars((string)(($_POST['Tel' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>"></td>
<td valign=top bgcolor="#EFEFEF">
<p>Mobile:</p>
</td>
<td valign=top><input name="Mobile<?php echo $i; ?>" type="text" size="30" value="<?php echo htmlspecialchars((string)(($_POST['Mobile' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>"></td>
</tr>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>E-mail: </p>
</td>
<td valign=top colspan="3"><input name="Email<?php echo $i; ?>" type="text" size="30" value="<?php echo htmlspecialchars((string)(($_POST['Email' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>"></td>
</tr>
<?php
} else {
?>
<tr>
<td valign=top bgcolor="#EFEFEF">
<p>E-mail: </p>
</td>
<td valign=top colspan="3"><input name="Email<?php echo $i; ?>" type="text" size="30" value="<?php echo htmlspecialchars((string)(($_POST['Email' . $i] ?? '')), ENT_QUOTES, 'UTF-8'); ?>"></td>
</tr>
<?php
}
if ($bShowFormDietary) {
?>
<tr>
<td colspan="4" valign=top bgcolor="#EFEFEF">Dietary restrictions / allergies:
<input name="DietaryReq<?php echo $i; ?>" type="text" size="80" value="<?php echo stripslashes((string)(($_POST['DietaryReq' . $i] ?? ''))); ?>">
</td>
</tr>
<?php
}
$sql = "SELECT * FROM MarketingExtraFields WHERE MarketingEventID=" . $id . " ORDER BY DisplayOrder, MarketingExtraFieldID";
$recE = mysql_query($sql);
while ($rowE = mysql_fetch_assoc($recE)) {
?>
<tr>
<td colspan="2" valign=top bgcolor="#EFEFEF"><?php echo $rowE["FieldLabel"]; ?>:</td>
<td colspan="2" valign="top">
<?php
if ($rowE["FieldType"] == "t")
echo "<input type='text' size='30' name='" . $rowE["FieldName"] . $i . "' value='" . $_REQUEST[$rowE["FieldName"]] . "'>";
if ($rowE["FieldType"] == "a")
echo "<textarea cols=40 rows=4 name='" . $rowE["FieldName"] . $i . "'>" . $_REQUEST[$rowE["FieldName"]] . "</textarea>";
if ($rowE["FieldType"] == "s") {
echo "<select name='" . $rowE["FieldName"] . $i . "'>";
$arrMEFV = split(",", $rowE["FieldOptions"]);
foreach ($arrMEFV as $MEFVKey => $MEFVVal) {
echo '<option value="' . $MEFVVal . '"';
if ($_REQUEST[$rowE["FieldName"]] == $MEFVVal)
echo " selected";
echo '>' . $MEFVVal . '</option>';
}
echo "</select>";
}
?>
</td>
</tr>
<?php
}
if (isset($row['ChooseOnlineInPerson']) && $row['ChooseOnlineInPerson'] > 0) {
?>
<tr>
<td colspan="2" valign=top bgcolor="#EFEFEF">Attending Online/ In Person:</td>
<td colspan="2" valign="top">
<?php
$req = true;
if ($i > 0) {
$req = false;
}
echo HTMLHelper::drawSelect(['name' => 'OnlineInPerson' . $i, 'value' => $_POST["OnlineInPerson" . $i], 'required' => $req, 'choices' => ['Online' => 'Online', 'In Person' => 'In Person'], 'expanded' => true]);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
if ($i > 1) {
?>
<p align="center"><input type="button" onclick="javascript:document.getElementById('candidate<?php echo $i; ?>').style.display = 'none';
document.getElementById('DivDisplayed<?php echo $i; ?>').value = '0'" value="Remove This Attendee">
<?php
}
?>
<?php
if ($i < 10) {
?>
<p align="center"><input type="button" onclick="javascript:document.getElementById('candidate<?php echo $i + 1; ?>').style.display = '';
document.getElementById('DivDisplayed<?php echo $i + 1; ?>').value = '1'" value="Add Another Attendee">
<?php
}
?>
</div>
<?php
}
if (!empty($row["RegFormInfo"]))
echo "<p align=center><b>" . nl2br($row["RegFormInfo"]) . "</b></p>";
?>
<p align="center"><input type="checkbox" name="subscribe" value="y" checked="checked"> Subscribe to our mailing list<br>
<i>We will advise you of other upcoming events. You can unsubscribe at any time.</i>
</p>
<?php
if (isset($row['SponsorName']) && strlen($row['SponsorName']) > 0) {
?>
<p align="center">
<input type="checkbox" name="sponsor_subscribe" value="y" checked="checked">
Share my details with the event sponsor, <?php echo $row['SponsorName'] ?><br>
<i>We will share your details with the event sponsor. You can unsubscribe at any time.</i>
</p>
<?php
}
?>
<p align="center">
<input type="checkbox" name="social_media_consent" value="y" checked="checked">
Do you provide consent that if any photos of you are taken during the event, these may be used by Consulting Engineers South Africa (CESA) on social media platforms and/or internal communications, including emails and digital platforms.
</p>
<div align="left">
<div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
<p>
<input type="submit" name="Submit" value="Submit to <?php echo $sSubmitTo; ?>" style="background-color:red;color:white;font-style:bold;padding: 12px;">
</p>
<p> </p>
</div>
</form>
<?php if (!$bMinimalRegForm) { ?>
<script type="text/javascript">
jQuery(function($) {
$('.marketing-event-dob').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
yearRange: 'c-120:c',
maxDate: 0
});
});
</script>
<?php } ?>
<?php
}
}
} else {
echo "Event not found.";
}