| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/declineeventreg.php |
<?php
die();
require("class.phpmailer.php");
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 ((double)microtime()*1000000);
$max = $length/2;
for($i=1; $i<=$max; $i++)
{
$password.=$conso[rand(0,19)];
$password.=$vocal[rand(0,4)];
}
return $password;
}
function CaseCorrect($str) {
$newstr = ucwords(strtolower($str));
return $newstr;
}
function XMail($to, $subject, $msg, $from, $CC, $type) {
$mail = new PHPMailer();
$mail->Mailer = "mail";
//$mail->Host = "smtp-relay.za24.co.za";
if ($type=="html") $mail->IsHTML(true);
$mail->From = $from;
$mail->FromName = $from;
$arrto = explode(",",$to);
for ($i=0; $i<count($arrto); $i++) {
$mail->AddAddress($arrto[$i]);
}
$mail->Subject=$subject;
$mail->Body=$msg;
if (!$mail->Send()) echo $mail->ErrorInfo;
}
$sendto = "bonolo@cesa.co.za,events@cesa.co.za";
// $sendto = "julia@xe.co.za";
$sendfrom = "bonolo@cesa.co.za";
//$sendto = "julia@xe.co.za";
$EventID = $_POST["EventID"];
$Organisation = $_POST["Organisation"];
$BookingName = $_POST["FirstName1"]." ".$_POST["Surname1"];
$BookingTel = $_POST["Tel1"];
$BookingMobile = $_POST["Mobile1"];
$BookingEmail = $_POST["Email1"];
$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["KnownAs".$i])) {
$bFormErrors = true;
$sError[] = "Attendee ".$i."'s name \"known as\" is required.";
}
*/
if (empty($_POST["Email".$i])) {
$bFormErrors = true;
$sError[] = "Your email address is required.";
}
if (!$bFormErrors) {
// Save all the form fields
foreach ($_POST as $FieldName => $FieldValue) {
$sql = "INSERT INTO EventFormFields (EventID, FirstName, LastName, FieldName, FieldValue, DateCreated) VALUES ('".$EventID."', '".$FirstName . "', '" . $Surname . "', '".$FieldName."', '".$FieldValue."', '".date("Y-m-d H:i")."')";
$queryresult = mysql_query($sql);
}
//Send the confirmation
//ini_set("SMTP", "SAACEMAIL");
$sql = "SELECT 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,
EndDate
FROM MarketingEvents
WHERE MarketingEvents.EventID=".$EventID;
$queryresult = mysql_query($sql);
if ($row = mysql_fetch_array($queryresult)) {
$msg="<p><b>DECLINED: ".$row["EventName"]."</b></p>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td><b>Organisation:</b></td><td>".$Organisation."</td></tr>
<tr><td><b>Name:</b></td><td>".$BookingName."</td></tr>
<tr><td><b>Email:</b></td><td>".$BookingEmail."</td></tr>
<tr><td><b>Tel:</b></td><td>".$BookingTel."</td></tr>
<tr><td><b>Mobile:</b></td><td>".$BookingMobile."</td></tr></table>";
XMail($sendto, "Marketing event invitation DECLINED", $msg, $sendfrom, "", "html");
}
?>
<p align="center" style="font-size:20px"><i><b>Thank you for your response</b></i></p>
<p align="center">We are sorry that you are unable to attend this prestigious event.</p>
<?php
}
?>