| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/eventregister_golf.php |
<?php
// error_reporting(E_ALL);
// ini_set("display_errors", 0);
?>
<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>
<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
}
function formCheck(objForm) {
bOK = true;
if (IsEmpty(objForm.BookingName)) {
bOK = false;
alert('Please fill in your name.');
} else if (IsEmpty(objForm.Organisation)) {
bOK = false;
alert('Please fill in your organisation.');
} 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
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 your surname.');
} else if (IsEmpty(objForm.FirstName<?php echo $i; ?>)) {
bOK = false;
alert('Please fill in your first name.');
} else if (IsEmpty(objForm.Mobile<?php echo $i; ?>)) {
bOK = false;
alert('Please fill in your mobile number.');
} else {
bOK = emailCheck(objForm.Email<?php echo $i; ?>.value);
}
}
<?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) {
/* 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
//$id = intval($_REQUEST["id"]);
include_once('inc_db.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');
$sql = "SELECT MarketingEvents.EventName, MarketingEvents.StartDate, MarketingEvents.City, MarketingEvents.Venue,
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.SponsorName,
CourseVenues.CourseVenueCity, CourseVenues.CourseVenueArea
FROM MarketingEvents LEFT JOIN CourseVenues ON MarketingEvents.Venue = CourseVenues.CourseVenueName
WHERE MarketingEvents.EventID=" . $id;
if (!($queryresult = mysql_query($sql))) {
throw new Exception("Error: " . mysql_error(get_current_connection()));
}
if ($row = mysql_fetch_array($queryresult)) {
if (empty($row["RegDeadline"]) || (strtotime($row["RegDeadline"]) > time())) {
?>
<form name="form1" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<div style="width:560px; padding:0px 50px 0px 50px; color:#345eab">
<?php
$bShowForm = true;
if (isset($_POST["ProcessForm"])) {
$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"];
$bFormErrors = false;
if (empty($Organisation)) {
$bFormErrors = true;
$sError[] = "Your organisation is required.";
}
$i = 1;
if (empty($_POST["FirstName" . $i])) {
$bFormErrors = true;
$sError[] = "Your first name is required.";
}
if (empty($_POST["Surname" . $i])) {
$bFormErrors = true;
$sError[] = "Your surname is required.";
}
if (empty($_POST["Email" . $i])) {
$bFormErrors = true;
$sError[] = "Your email address is required.";
}
if (empty($_POST["Mobile" . $i])) {
$bFormErrors = true;
$sError[] = "Your cell number is required.";
}
}
if (isset($_POST["ProcessForm"]) && ($_POST["ProcessForm"] == 2)) {
include_once("sendeventreg_golf.php");
if (!$bFormErrors)
$bShowForm = false;
}
if ($bShowForm) {
if (isset($bFormErrors) && $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 (!isset($_POST["ProcessForm"]) || ($bFormErrors && ($_POST["ProcessForm"] == 1))) {
?>
<br>
<p align=center style='text-align:center'><b><?php echo date("l j F Y", strtotime($row["StartDate"])); ?><br>
at <?php echo $row["Venue"]; ?></b></p>
<p align=center style='text-align:center'><b>* Required fields</b></p>
<input type="hidden" name="ProcessForm" value="1">
<input type="hidden" name="EventID" value="<?php echo $id; ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<table border=0 cellpadding=2 cellspacing=0 bgcolor="#FFFFFF">
<tr>
<td width="116" valign=top nowrap="nowrap"><strong>First Name:</strong></td>
<td width="274" valign=top nowrap="nowrap"><input name="FirstName1" type="text" size="40" value="<?php
if (isset($_POST["FirstName1"])) {
echo stripslashes($_POST["FirstName1"] . "");
}
?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Surname:</strong></td>
<td valign=top nowrap="nowrap"><input name="Surname1" type="text" size="40" value="<?php echo $_POST["Surname1"]; ?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Company Name: </strong></td>
<td valign=top nowrap="nowrap"><input name="Organisation" id="Organisation" type="text" size="40" value="<?php echo stripslashes($_POST["Organisation"] . ""); ?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Order Number: </strong></td>
<td valign=top nowrap="nowrap"><input name="OrderNumber" id="OrderNumber" type="text" size="40" value="<?php echo stripslashes($_POST["OrderNumber"] . ""); ?>"></td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>VAT Number: </strong></td>
<td valign=top nowrap="nowrap"><input name="VATNumber" id="VATNumber" type="text" size="40" value="<?php echo stripslashes($_POST["VATNumber"] . ""); ?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Address: </strong></td>
<td valign=top nowrap="nowrap"><input name="Address1" id="Address1" type="text" size="40" value="<?php echo stripslashes($_POST["Address1"] . ""); ?>"><br>
<input name="Address2" id="Address2" type="text" size="40" value="<?php echo stripslashes($_POST["Address2"] . ""); ?>"><br>
<input name="Address3" id="Address3" type="text" size="40" value="<?php echo stripslashes($_POST["Address3"] . ""); ?>"><br>
<input name="City" id="City" type="text" size="40" value="<?php echo stripslashes($_POST["City"] . ""); ?>"><br>
<input name="PostalCode" id="PostalCode" type="text" size="40" value="<?php echo stripslashes($_POST["PostalCode"] . ""); ?>">
</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>E-mail:</strong></td>
<td valign=top nowrap="nowrap"><input name="Email1" type="text" size="40" value="<?php echo $_POST["Email1"]; ?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Mobile:</strong></td>
<td valign=top nowrap="nowrap"><input name="Mobile1" type="text" size="40" value="<?php echo $_POST["Mobile1"]; ?>"> *</td>
</tr>
<tr>
<td valign=top nowrap="nowrap"><strong>Telephone:</strong></td>
<td valign=top nowrap="nowrap"><input name="Tel1" type="text" size="40" value="<?php echo $_POST["Tel1"]; ?>"></td>
</tr>
<tr>
<td valign=top nowrap="nowrap">
<strong>Dietary restrictions / allergies:</strong>
</td>
<td valign=top nowrap="nowrap">
<input name="DietaryReq1" type="text" size="80" value="<?php echo stripslashes($_POST["DietaryReq1"] . ""); ?>">
</td>
</tr>
<tr>
<td colspan="2" valign=top nowrap="nowrap"><strong>Please select your requirements as follows:</strong></td>
</tr>
<tr>
<td colspan="2" valign=top nowrap="nowrap">
<p>
<input name="Teams" type="radio" id="Teams" value="Single_Player" checked>
Single Player<br>
<input name="Teams" type="radio" id="Teams" value="4-Balls">4-Ball Teams, number of teams: <input type="text" name="NumTeams" size="5"><br>
You will be able to enter player details on the next screen
</p>
<p>
<input name="Premium_Hole" type="checkbox" id="Premium_Hole" value="Yes"> I would like to book a Premium Hole
</p>
<?php
if ($id == 194) {
// Western Cape Golf Day
?>
<input type="hidden" name="Carts" value="Not_Required">
<p>Golf carts to be booked directly with golf club</p>
<?php
} else {
?>
<p>
<input name="Carts" type="radio" id="Carts" value="Required">Golf carts required (R500), number of carts: <input type="text" name="NumCarts" size="5"><br>
<input name="Carts" type="radio" id="Carts" value="Not_Required" checked>
Golf carts not required<br>
(golf carts are allocated on a "first come, first served" basis)
</p>
<?php
}
?>
</td>
</tr>
<tr>
<td colspan="2" valign=top nowrap="nowrap">
<?php
if ($id == 194) {
// Western Cape Golf Day
?>
<strong>Cost: R3250 per four-ball, R3500 per premium hole</strong>
<?php
} else {
?>
<strong>Cost: R6 000.00 excl VAT per four-ball, R500 per golf cart</strong>
<?php
}
?>
</td>
</tr>
</table>
<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>
<p>If you have any queries please contact Bonolo Nkgodi<br />
on 011 463 2022 or <a href="mailto:bonolo@cesa.co.za">bonolo@cesa.co.za</a></p>
<p align='center'><input type="submit" value="Continue"></p>
</div>
<?php
}
if (isset($_POST["ProcessForm"]) && ((!$bFormErrors && ($_POST["ProcessForm"] == 1)) || ($bFormErrors && ($_POST["ProcessForm"] == 2)))) {
?>
<p><b>NB: Your registration has not been submitted yet, please complete your player details below then click Submit.</b></p>
<p>If you do not have all the required information, please leave those fields blank.</p>
<input type="hidden" name="ProcessForm" value="2">
<input type="hidden" name="EventID" value="<?php echo $id; ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="FirstName1" value="<?php echo stripslashes($_POST["FirstName1"] . ""); ?>">
<input name="Surname1" type="hidden" value="<?php echo $_POST["Surname1"]; ?>">
<input name="Organisation" id="Organisation" type="hidden" value="<?php echo stripslashes($_POST["Organisation"] . ""); ?>">
<input name="OrderNumber" id="OrderNumber" type="hidden" value="<?php echo stripslashes($_POST["OrderNumber"] . ""); ?>">
<input name="VATNumber" id="VATNumber" type="hidden" value="<?php echo stripslashes($_POST["VATNumber"] . ""); ?>">
<input name="Address1" id="Address1" type="hidden" value="<?php echo stripslashes($_POST["Address1"] . ""); ?>">
<input name="Address2" id="Address2" type="hidden" value="<?php echo stripslashes($_POST["Address2"] . ""); ?>">
<input name="Address3" id="Address3" type="hidden" value="<?php echo stripslashes($_POST["Address3"] . ""); ?>">
<input name="City" id="City" type="hidden" value="<?php echo stripslashes($_POST["City"] . ""); ?>">
<input name="PostalCode" id="PostalCode" type="hidden" value="<?php echo stripslashes($_POST["PostalCode"] . ""); ?>">
<input name="Email1" type="hidden" value="<?php echo $_POST["Email1"]; ?>">
<input name="Mobile1" type="hidden" value="<?php echo $_POST["Mobile1"]; ?>">
<input name="Tel1" type="hidden" value="<?php echo $_POST["Tel1"]; ?>">
<input name="DietaryReq1" type="hidden" value="<?php echo $_POST["DietaryReq1"]; ?>">
<input name="Teams" type="hidden" value="<?php echo $_POST["Teams"]; ?>">
<input name="NumTeams" type="hidden" value="<?php echo $_POST["NumTeams"]; ?>">
<input name="Premium_Hole" type="hidden" value="<?php echo $_POST["Premium_Hole"]; ?>">
<input name="Carts" type="hidden" value="<?php echo $_POST["Carts"]; ?>">
<input name="NumCarts" type="hidden" value="<?php echo $_POST["NumCarts"]; ?>">
<input name="subscribe" type="hidden" value="<?php echo $_POST["subscribe"]; ?>">
<input name="sponsor_subscribe" type="hidden" value="<?php echo $_POST["sponsor_subscribe"]; ?>">
<input name="social_media_consent" type="hidden" value="<?php echo $_POST["social_media_consent"]; ?>">
<?php
$iNumPlayers = 1;
if ($_POST["Teams"] == "4-Balls")
$iNumPlayers = intval("0" . $_POST["NumTeams"]) * 4;
if ($iNumPlayers == 0)
$iNumPlayers = 4;
?>
<input type="hidden" name="NumPlayers" value="<?php echo $iNumPlayers; ?>">
<p>Player details:</p>
<table border=0 cellpadding=2 cellspacing=0 bgcolor="#FFFFFF">
<tr>
<td><strong></strong></td>
<td><strong>Player Name</strong></td>
<td><strong>Cell Number</strong></td>
<td><strong>Shirt Size</strong></td>
</tr>
<tr>
<td>1.</td>
<td><input type="text" name="Player1" value="<?php echo $_POST["FirstName1"] . " " . $_POST["Surname1"]; ?>"></td>
<td><input type="text" name="Cell1" value="<?php echo $_POST["Mobile1"]; ?>"></td>
<td><input type="text" name="Shirt1" value=""></td>
</tr>
<?php
for ($i = 2; $i <= $iNumPlayers; $i++) {
?>
<tr>
<td><?php echo $i; ?>.</td>
<td><input type="text" name="Player<?php echo $i; ?>" value=""></td>
<td><input type="text" name="Cell<?php echo $i; ?>" value=""></td>
<td><input type="text" name="Shirt<?php echo $i; ?>" value=""></td>
</tr>
<?php
}
?>
</table>
<p>If you have any queries please contact Bonolo Nkgodi on 011 463 2022 or <a href="mailto:bonolo@cesa.co.za">bonolo@cesa.co.za</a></p>
</div>
<div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
<input type="image" name="imageField" id="imageField" src="/images/btnsubmit.jpg">
<?php
}
?>
</form>
<?php
}
} else {
?>
<p><b>Registrations for this event have now closed</b></p>
<?php
}
} else {
echo "Event not found.";
}