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_awards.php

<?php
//die();
?>
<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) {

        /* 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 = 347; //intval($_REQUEST["id"]);

include('inc_db.php');
$db = mysql_connect($loghost, $logid, $logpwd);

mysql_select_db($dbname, $db);

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

$queryresult = mysql_query($sql) or die(mysql_error());

if ($row = mysql_fetch_array($queryresult)) {
    // check the dates
    $StartDatePlusTime = date("Y-m-d", strtotime($row["StartDate"])) . " " . date("H:i", strtotime($row["StartTime"]));
    if (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 CESA (<a href='mailto:events@cesa.co.za'>events@cesa.co.za</a>) for more information.</center></b>";
    } else {
?>
        <!--<p align="center"><img src="/images/awards2016header.jpg" width="636" height="178"></p>-->
        <form name="form1" method="post" action="/awards/register.php">
            <div style="width:620px; padding:0px 100px 0px 100px; color:#345eab; background-color:white">

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

                if ($bShowForm) {
                    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>
                    <p align=center style='text-align:center'><b>Tab to next field&nbsp;&nbsp;&nbsp; * Required fields</b></p>
                    <input type="hidden" name="ProcessForm" value="1">
                    <input type="hidden" name="EventID" value="<? echo $id; ?>">
                    <input type="hidden" name="id" value="<? echo $id; ?>">
                    <input type="hidden" name="type" value="<?php echo $_REQUEST["type"]; ?>">
                    <table border=0 cellpadding=2 cellspacing=0 bgcolor="#FFFFFF" width="100%">
                        <tr>
                            <td valign=top nowrap="nowrap" width="40%"><strong>Surname:</strong></td>
                            <td valign=top><input name="Surname1" type="text" size="40" value="<?php echo $_POST["Surname1"]; ?>">&nbsp;*</td>
                        </tr>
                        <tr>
                            <td valign=top nowrap="nowrap"><strong>First Name:</strong></td>
                            <td valign=top><input name="FirstName1" type="text" size="40" value="<?php echo stripslashes($_POST["FirstName1"] . ""); ?>">&nbsp;*</td>
                        </tr>
                        <tr>
                            <td valign=top nowrap="nowrap"><strong>Company Name: </strong></td>
                            <td valign=top><input name="Organisation" id="Organisation" type="text" size="40" value="<?php echo stripslashes($_POST["Organisation"] . ""); ?>">&nbsp;*</td>
                        </tr>
                        <tr>
                            <td valign=top nowrap="nowrap"><strong>E-mail:</strong></td>
                            <td valign=top><input name="Email1" type="text" size="40" value="<?php echo $_POST["Email1"]; ?>">&nbsp;*</td>
                        </tr>
                        <tr>
                            <td valign=top nowrap="nowrap"><strong>Mobile:</strong></td>
                            <td valign=top><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><input name="Tel1" type="text" size="40" value="<?php echo $_POST["Tel1"]; ?>"></td>
                        </tr>
                        <tr>
                            <td valign=top nowrap="nowrap"><strong>Dietary Requirements:</strong></td>
                            <td valign=top><input name="DietaryReq1" type="text" size="40" value="<?php echo stripslashes($_POST["DietaryReq1"] . ""); ?>">
                            </td>
                        </tr>
                        <?php
                        if ((!isset($_REQUEST["type"]) || empty($_REQUEST["type"]) || ($_REQUEST["type"] != "buyer")) && ($_REQUEST["type"] != "ypf")) {
                        ?>
                            <tr>
                                <td valign=top nowrap="nowrap"><strong>Partner Surname:</strong></td>
                                <td valign=top><input name="Surname2" type="text" size="40" value="<?php echo $_POST["Surname2"]; ?>"></td>
                            </tr>
                            <tr>
                                <td valign=top nowrap="nowrap"><strong>Partner First Name:</strong></td>
                                <td valign=top><input name="FirstName2" type="text" size="40" value="<?php echo stripslashes($_POST["FirstName2"] . ""); ?>"></td>
                            </tr>
                            <tr>
                                <td valign=top nowrap="nowrap"><strong>Dietary Requirements:</strong></td>
                                <td valign=top><input name="DietaryReq2" type="text" size="40" value="<?php echo stripslashes($_POST["DietaryReq2"] . ""); ?>">
                                </td>
                            </tr>
                        <?php
                        }
                        if ($_REQUEST["type"] == "buyer") {
                        ?>
                            <tr>
                                <td valign=top nowrap="nowrap"><strong>Tables / Seats:</strong><br><br>
                                    Each table seats ten</td>
                                <td valign=top>
                                    Number of tables required: <input name="tables" type="text" size="3" value="<?php echo stripslashes($_POST["tables"] . ""); ?>" style="width:50px">
                                    <br>
                                    (R12 500 each excl VAT)<br>
                                    <strong>OR</strong><br>
                                    Number of seats required: <input name="seats" type="text" size="3" value="<?php echo stripslashes($_POST["seats"] . ""); ?>" style="width:50px">
                                    <br>
                                    (R2 000 each excl VAT)<br>
                                </td>
                            </tr>

                        <?php
                        }
                        ?>
                    </table>
                    <p>
                        If you have any queries please contact Bonolo Nkgodi on 011 463 2022</p>

                    <!--
                    <?php
                    if ($_REQUEST["type"] == "booktables") {
                    ?>
                                                            <p><b>ATTENDEE DETAILS</b></p>
                                                                  <p>
                                                                  You will be sent an email shortly with instructions on how to book your table.<br>
                                                                  If you have any queries please contact:</p>
                                                                  <p>Bonolo Nkgodi on 011 463 2022</p>
                        <?php
                    }
                        ?>
                    -->
                    <div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
            </div>
            <!-- background-image:url('/images/awards2017footer.jpg'); background-repeat:no-repeat; background-position:bottom center; -->
            <div style="width:650px; height:200px; padding-left:170px; background-color:white">
                <input type="submit" name="imageField" id="imageField" old-src="/images/btnsubmit.jpg?y=2019" value="Submit">&nbsp;
                <input type="reset" value="Reset" old-src="/images/btnreset.jpg?y=2019" old-width="153" old-height="40" old-onclick="this.form.reset()" />
            </div>
        </form>
<?php
                }
            }
        } else {
            echo "Event not found.";
        }
?>