Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/
Upload File :
Current File : /var/www/cesa.co.za/php/eventregister.php

<?php
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
?>
<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 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
        }
        ?>
        /*
         } 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
//$id = intval($_REQUEST["id"]);

if (in_array($id, array(539, 540, 541, 555))) {
?>
    <h1 align="center">REGISTRATION</h1><br>
    <p>Please book directly with SAICE for this course:<br>
        Dawn Hermanus or Sharon Mugeri<br>
        Tel No: +27 (0)11 805 5971
    </p>
    <?php
} else {
    include_once($_SERVER['DOCUMENT_ROOT'] . '/php/inc_db.php');
    include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');
    $db = mysqli_connect($loghost, $logid, $logpwd, $dbname);

    $sql = "SELECT MarketingEvents.EventName, MarketingEvents.Level, 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,
	CourseVenues.CourseVenueCity, CourseVenues.CourseVenueArea
	FROM MarketingEvents LEFT JOIN CourseVenues ON MarketingEvents.Venue = CourseVenues.CourseVenueName
	WHERE MarketingEvents.EventID=" . $id;

    $queryresult = mysqli_query($db, $sql) or die();

    if ($row = mysqli_fetch_array($queryresult)) {

        // check the dates
        $sql2 = "SELECT * FROM EventSchedules WHERE EventID=" . $id . " ORDER BY ScheduleDate";
        $queryresult2 = mysqli_query($db, $sql2);
        $ScheduleDates = "";
        $bEventInPast = false;
        while ($row2 = mysqli_fetch_array($queryresult2)) {
            $StartDatePlusTime = date("Y-m-d", strtotime($row2["ScheduleDate"])) . " " . date("H:i:s", strtotime(substr($row2["StartTime"], 11, 5)));
            $ScheduleDates .= "<b>&middot;</b>" . date("D j F Y", strtotime($row2["ScheduleDate"])) . "<br>" . substr($row2["StartTime"], 0, 5) . " to " . substr($row2["EndTime"], 0, 5) . "<BR><br>";
            if (strtotime($StartDatePlusTime) < time())
                $bEventInPast = true;
        }

        // check that there are still available spaces
        $iNumBooked = 0;
        $sql2 = "SELECT count(*) AS NumBooked FROM SchoolAttendees WHERE Cancelled=0 AND EventID=" . $id;
        $queryresult2 = mysqli_query($db, $sql2);
        if ($row2 = mysqli_fetch_array($queryresult2)) {
            $iNumBooked = $row2["NumBooked"];
        }

        $bNoSpace = (($row["AvailableSpaces"] > 0) && ($iNumBooked >= $row["AvailableSpaces"]));

        //	if ($bEventInPast || $bNoSpace || ($row["Cancelled"]==1)) {
        if (1 == 2) {
            // No space left
            echo "<b><center>Registrations have now closed for this event, please contact Blessings (<a href='mailto:blessings@cesa.co.za'>blessings@cesa.co.za</a>) with your details and the course you are interested in. Should there be enough interest another course will be scheduled.</center></b>";
        } else {

            $bShowForm = true;
            if (isset($_POST["ProcessForm"]) && ($_POST["ProcessForm"] == 1)) {
                include_once("sendeventreg.php");
                if (!$bFormErrors)
                    $bShowForm = false;
            }

            if ($bShowForm) {
    ?>
                <img src="/images/cesa.gif" width="192" height="75" align=left>
                <?php
                if ($id == 187) {
                    include_once("inc_gamalogos.php");
                }
                ?>
                <h1 align="center">REGISTRATION FORM</h1><br>
                <?php
                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>";
                }
                ?>
                <br>
                <u><?php echo $row["EventName"]; ?></u>
                <p align=center style='text-align:center'><b>Please fill in the form, and then press the Submit button to send it to CESA.<br><br>
                        <span class="style1">*</span> = Not required
                    </b></p>
                <form name="form1" method="post" action="/node/517" 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">
                        <tr>
                            <td width="28%" valign=top bgcolor="#EFEFEF">
                                <p><strong>Organisation Name: </strong></p>
                            </td>
                            <td width="72%" valign=top><input name="Organisation" id="Organisation" type="text" size="45" value="<?php echo stripslashes($_POST["Organisation"] . ""); ?>"></td>
                        </tr>
                    </table>
                    <p><b>Attendees</b></p>
                    <p>To add more attendees, click the &quot;Add Another
                        Attendee&quot; 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">
                            <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" 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">&nbsp;</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 $_POST["Designation" . $i]; ?>">
                                    (e.g. CEO, Managing Director, Personal Assistant etc)</td>
                            </tr>
                            <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($_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 $_POST["Surname" . $i]; ?>"></td>
                            </tr>
                            <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($_POST["DietaryReq" . $i] . ""); ?>">
                                </td>
                            </tr>
                            <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 $_POST["Tel" . $i]; ?>"></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 $_POST["Mobile" . $i]; ?>"></td>
                            </tr>
                            <tr>
                                <td valign=top bgcolor="#EFEFEF">
                                    <p>Fax: </p>
                                </td>
                                <td valign=top><input name="Fax<?php echo $i; ?>" type="text" size="30" value="<?php echo $_POST["Fax" . $i]; ?>"></td>
                                <td valign=top bgcolor="#EFEFEF">
                                    <p>E-mail: </p>
                                </td>
                                <td valign=top><input name="Email<?php echo $i; ?>" type="text" size="30" value="<?php echo $_POST["Email" . $i]; ?>"></td>
                            </tr>
                            <tr>
                                <td valign=top bgcolor="#EFEFEF" colspan="2">
                                    <p>Number of years experience in the industry: </p>
                                </td>
                                <td valign=top><input name="YearsExperience<?php echo $i; ?>" type="text" size="30" value="<?php echo $_POST["YearsExperience" . $i]; ?>"></td>
                            </tr>

                        </table>
                        <?php
                        if ($id == 187) {
                            $showform = true;
                            include_once("inc_gama.php");
                        }
                        ?>
                        <?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
                    }
                        ?>
                            <div align="left">
                                <div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
                                <p>
                                    <input type="submit" name="Submit" value="Submit to CESA" style="background-color:red;color:white;font-style:bold;padding: 12px;">
                                </p>

                                <p>&nbsp; </p>
                            </div>
                </form>
                <?php
                if (($id >= 542) && ($id <= 545)) {
                ?>
                    <p align="left"><strong>Please fax proof of payment to Ebeth on 086 668 7880. For all enquiries contact Ebeth on 084 361 1118.</strong></p>
                <?php
                } else {
                ?>
                    <p align="left"><strong>Please fax proof of payment to the SCE on 086 628 0722. For all enquiries contact the SCE on (011) 463 2022.</strong></p>
                <?php
                }

                $sBankAccName = "SAACE";
                if (!empty($row["BankAccName"]))
                    $sBankAccName = $row["BankAccName"];
                $sqlbank = "SELECT * FROM SchoolBankAccs WHERE BankAccName = '" . $sBankAccName . "'";
                $recbank = mysqli_query($db, $sqlbank);
                if ($rowbank = mysqli_fetch_assoc($recbank)) {
                    extract($rowbank);
                }
                ?>
                <p align="left"><b><i>Deposit payment to account:</i></b>
                <table border=0>
                    <tr>
                        <td><b>Account&nbsp;Name:</b></td>
                        <td><?php echo $BankAccName; ?></td>
                    </tr>
                    <tr>
                        <td><b>Bank:</b></td>
                        <td><?php echo $BankAccBank; ?></td>
                    </tr>
                    <tr>
                        <td><b>Branch&nbsp;Name:</b></td>
                        <td><?php echo $BankAccBranch; ?></td>
                    </tr>
                    <tr>
                        <td><b>Branch&nbsp;Code:</b></td>
                        <td><?php echo $BankAccBranchCode; ?></td>
                    </tr>
                    <tr>
                        <td><b>Account&nbsp;No:</b></td>
                        <td><?php echo $BankAccNo; ?></td>
                    </tr>
                </table>
                </p>
                <p align="left"><i><span style='color:red'>Note. No refunds will be awarded if delegates cancel <?php
                                                                                                                if ($id == 375) {
                                                                                                                    echo "after the 15th September 2009";
                                                                                                                } else {
                                                                                                                    echo "within 5 working days / Substitutions of delegates will be allowed.";
                                                                                                                }
                                                                                                                ?></span></i></p>
                <table border=1 width=100% cellspacing=0 cellpadding=5>
                    <tr>
                        <td colspan=4><b><i><u>For office use only.</u></i></b></td>
                    </tr>
                    <tr>
                        <td>Date: _________________</td>
                        <td>Acc No: ________________________</td>
                        <td>Invoice No: _____________________ </td>
                        <td>Code: __________________</td>
                    </tr>
        <?php
            }
        }
    } else {
        echo "Event not found.";
    }
        ?>
                </table>
            <?php
        }
            ?>
            <script language="JavaScript" type="text/javascript">
                function Orgcallback(oInfo) {
                    document.getElementById('Organisation').value = oInfo.id;
                }
                sScriptPrefix = "/autosuggest/organisation.php?r=<?php echo rand(); ?>&";
                var options1 = {
                    script: sScriptPrefix,
                    varname: "Input",
                    delay: 0,
                    timeout: 10000,
                    shownoresults: false,
                    minchars: 3,
                    maxheight: 250,
                    callback: Orgcallback
                };
                var as1 = new AutoSuggest('Organisation', options1);
            </script>