ConfWare online event management - quotation + 72 hours demo system query form
Event & Company Details/Contact Person (Organiser
of Event) Form
Enter the details of your event and company/organisation, then
submit this form by clicking on the "Send" button. The
details submitted will be used to setup your event. We will contact you once we have set up a draft
of your event to confirm details and for completion of your event information if necessary.
NOTE: If you are unable to complete some of the details
on the form we will collect them from you when we report to you.
We will send you additional query sheets for certain selected
modules too (hotel booking, programmes, etc.).
/*
############################# FormPro 1.0 ###########################
### |-----------------------------------------------------------| ###
### | WRITTEN 2006 by planetluc.com c/o Lukas Stalder | ###
### | THIS SCRIPT MAY NOT BE REDISTRIBUTED OR RESELLED | ###
### | IN ANY WAYS. | ###
### |-----------------------------------------------------------| ###
#####################################################################
*/
/*
----------------------------------------------------------------------------------
| script code - don't make changes below here unless you know what you're doing. |
----------------------------------------------------------------------------------
*/
error_reporting(0);
session_start();
/*
----------------------------------------------------------------------------------
| script functions |
----------------------------------------------------------------------------------
*/
function spaces($num, $fill=" "){
$foo="";
for ($i=0; $i<$num; $i++) $foo.=$fill;
return $foo;
}
function isValidEmail($addr){
if(eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr))
return true;
else
return false;
}
function jsCharCount(){
if ($GLOBALS['cfCharCountFunc'] != 1){
$html = "\n";
$GLOBALS['cfCharCountFunc'] = 1;
return $html;
}
}
function getXmlFile($file, $utf8 = true){
function deutf8(&$val){
$val = utf8_decode($val);
}
// new dom element
$dom = new DomDocument();
$dom->load($file);
// get the 'item' elements
if ($domItems = $dom->getElementsByTagName("item")){
$i = 0;
$fields = array();
foreach($domItems as $di){
$fields[$i][0] = ($di->getAttribute("caption"));
$fields[$i][1] = ($di->getAttribute("name"));
$fields[$i][2] = ($di->getAttribute("type"));
$fields[$i][3] = ($di->getAttribute("attr"));
$fields[$i][4] = ($di->getAttribute("mandatory"));
$fields[$i][5] = ($di->getAttribute("error"));
if ($utf8 !== true){
array_walk($fields[$i], "deutf8");
}
$i++;
}
return $fields;
}else return false;
}
/*
----------------------------------------------------------------------------------
| script start |
----------------------------------------------------------------------------------
*/
// load config
include_once("config.inc.php");
// load mailer class
require_once("lib/mailer/class.phpmailer.php");
// captcha stuff
$_SESSION['fp_captcha_case'] = $fpCfg['captcha_case'];
$_SESSION['fp_captcha_symbol'] = $fpCfg['captcha_symbol'];
$_SESSION['fp_captcha_shapes'] = $fpCfg['captcha_shapes'];
$_SESSION['fp_captcha_width'] = $fpCfg['captcha_width'];
$_SESSION['fp_captcha_height'] = $fpCfg['captcha_height'];
$_SESSION['fp_captcha_min_chars'] = $fpCfg['captcha_min_chars'];
$_SESSION['fp_captcha_max_chars'] = $fpCfg['captcha_max_chars'];
// set version number & stuff
$version = "1.0";
$errorPointer = ($fpCfg['posError'] == "above") ? "↓ " : "↑ ";
$fields = getXmlFile($_SERVER['DOCUMENT_ROOT'].$fpCfg['dirScript']."form.xml", $fpCfg['utf8_encoding']);
// get message caption/values indent
$fpCfg['msgIndent'] = 0;
foreach ($fields as $field){
if ($field[2] != "captcha"){
if (strlen($field[0]) > $fpCfg['msgIndent'] && $field[2] != "divider") $fpCfg['msgIndent'] = strlen($field[0]);
}
}
$fpCfg['msgIndent'] += 3;
// start form evaluation
unset($error);
if ($_REQUEST['do']=="send"){
$error = false;
$fromAddress = "";
$message = "";
foreach ($fields as $field){
if ($field[4] == "*"){
if ($field[3] == "email"){
if (!isValidEmail($_REQUEST[$field[1]])) $error[$field[1]] = $field[5];
}else{
if ($field[2] == "file"){
if ($_FILES[$field[1]]['size'] < 1) $error[$field[1]] = $field[5];
}else if ($field[2] == "captcha"){
$hash = ($fpCfg['captcha_case'] === true) ? strtolower($_REQUEST[$field[1]]) : $_REQUEST[$field[1]];
if (md5($hash) != $_SESSION["fp_captchahash_".$field[1]]) $error[$field[1]] = $field[5];
}else{
if ($_REQUEST[$field[1]] == "" || $_REQUEST[$field[1]] == " " || $_REQUEST[$field[1]] == " ") $error[$field[1]] = $field[5];
}
}
}
}
if ($error === false){
// init mail class
$mail = new PHPMailer();
$mail->Subject = $fpCfg['emailSubject'];
$mail->IsMail();
$mail->FromName = "";
$mail->AddAddress($fpCfg['targetAddress']);
$message = $fpCfg['emailSubject']." \n";
for ($i = 0; $i < strlen($fpCfg['emailSubject']); $i++) $message .= "*";
$message .= " \n\n".$fpCfg['msgDate'].":".spaces($fpCfg['msgIndent']-strlen($fpCfg['msgDate'])).date($fpCfg['dateFormat']);
foreach ($fields as $field){
if ($field[2] == "divider"){
$message .= "\n---------------------------------------";
}else if ($field[2] == "file"){
if (is_uploaded_file($_FILES[$field[1]]['tmp_name'])){
$name = preg_replace("/[^a-zA-Z0-9\-\_\.]/", "_", $_FILES[$field[1]]['name']);
$mail->AddAttachment($_FILES[$field[1]]['tmp_name'], $name, "base64", $_FILES[$field[1]]['type']);
$message .= "\n".$field[0].":".spaces($fpCfg['msgIndent']-strlen($field[0]));
$message .= $name;
}
}else if ($field[2] != "captcha"){
$message .= "\n".$field[0].":".spaces($fpCfg['msgIndent']-strlen($field[0]));
// kill ' if magic quotes on
if (get_magic_quotes_gpc() == 1){
if (is_array($_REQUEST[$field[1]])){
$tmp = array();
foreach ($_REQUEST[$field[1]] as $key => $val){
$tmp[$key] = stripslashes($val);
}
$_REQUEST[$field[1]] = $tmp;
}else{
$_REQUEST[$field[1]] = stripslashes($_REQUEST[$field[1]]);
}
}
if ($field[3] == "email"){
$message .= "mailto:".$_REQUEST[$field[1]];
$mail->From = $_REQUEST[$field[1]];
}else if ($field[2] == "checkbox" || $field[2] == "multiselect"){
$multi = "";
foreach ($_REQUEST[$field[1]] as $val){
$divider = ($multi != "") ? ", " : "";
$multi .= (isset($val) && $val != "") ? $divider.$val : "";
}
$message .= $multi;
}else{
$message .= $_REQUEST[$field[1]];
}
}
$message .= " ";
}
$message .= "\n ";
// set mail message
$mail->Body = $message;
// send mail
if ($mail->Send() !== true){
echo $mail->ErrorInfo;
}
echo $fpCfg['txtThankyou'];
//echo "
Mail Message
(This demo does not send any mails - but the message would be like below) ";
//echo "