".$version."
Current PHP version: ".phpversion()."
Current Revision Date: $date");
break;
}
}
$date=date("l, F dS, Y \a\\t g:i a");
$server=$_SERVER['SERVER_NAME'];
$msg="Here is the information submitted to $formName from $_SERVER[REMOTE_ADDR] on $date\r\n\r\n------------------------\r\n";
//...... Make sure we keep the variables
$subject = $_REQUEST['subject'];
$thankyoupage = $_REQUEST['thankyoupage'];
$xmlFile = $_REQUEST['xmlfile'];
$unreg = $_REQUEST['uR'];
$email = $_REQUEST['eM'];
if (file_exists($xmlFile))
{
$fd = fopen(basename($xmlFile),'r');
while(!feof($fd))
{
$contents .= fgets($fd,1024);
}
fclose($fd);
}
else
{
err("No <xml> data file found
Please upload the data xml file ".$_REQUEST['xmlfile']);
}
$file_info = preg_replace("/\r|\n/"," ",$contents);
//...... Includes the form results in your thank you page
$incresults = (preg_match('/
/',$file_info));
//...... Sends email of form results to the user
$emailusr = (preg_match('//',$file_info));
preg_match('//',$file_info,$matches);
$mailto = $matches[1];
preg_match('//',$file_info,$matches2);
$thanksMsg = unhtmlentities($matches2[1]);
preg_match('//',$file_info,$matches3);
$backgroundclr = $matches3[1];
preg_match('//',$file_info,$matches4);
$fontclr = $matches4[1];
preg_match('//',$file_info,$matches5);
$autoresponse = $matches5[1];
if(!$thanksMsg)
{
$thanksMsg="Thank you for your form submission!";
}
if(!$subject)
{
$subject="Form Submission";
}
//...... Reversing array elements so they appear in correct form order
$_REQVARS = array_merge($_POST,$_GET);
//...... Delete them from the request array, we won't need
//...... to send these in the actual email.
unset($_REQVARS['thankyoupage']);
unset($_REQVARS['subject']);
unset($_REQVARS['mailto']);
unset($_REQVARS['xmlfile']);
unset($_REQVARS['thankyoumessage']);
unset($_REQVARS['uR']);
unset($_REQVARS['eM']);
$addtoThank.="Below is the information you submitted:
";
$txtmsg=$formName.'|'.date("Y-m-d H:i:s").'|'.$_SERVER['REMOTE_ADDR'].'|';
$_REQVARS=array_reverse($_REQVARS);
foreach($_REQVARS as $key=>$value)
{
$new1=str_replace("_"," ",$key);
$msg .= "$new1: ".stripslashes($value)."\r\n\r\n";
$addtoThank.="$new1: ".stripslashes($value)."
";
$txtmsg .= "$new1: ".stripslashes($value)."|";
}
$addtoThank.="
";
$addtoThank=str_replace("_"," ",$addtoThank);
//...... Write to the text file here
if ($saveFile != '[FILENAME]')
{
$fd = fopen($saveFile,"a+");
ccfputcsv($fd, $txtmsg);
fclose($fd);
}
if($unreg == 'true')
{
$unregMsg="";
$msg .= "------------------------\r\n\r\nThis Form was sent to you using CoffeeCup Form Builder.\r\nPlease tell a friend about us: http://www.coffeecup.com/form-builder/\r\n";
}
else
{
$unregMsg = '';
}
$newMsg= $msg . $autoresponse;
//...... Construct a proper mime/UTF-8 for extended ASCII, and internationalization
$headers = "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=UTF-8\r\n\r\n";
//...... If they specify "email" in their form, it will set the reply-to field.
if($email)
{
$sentMail = mail($mailto,$subject,$newMsg,"Reply-To: $email\r\nFrom: $email\r\n$headers");
//...... MAIL TO USER
if($emailusr)
{
mail($email,$subject,$newMsg,"Reply-To: $mailto\r\nFrom: $mailto\r\n$headers");
}
}
//...... Send email as regular web server user
else
{
$sentMail = mail($mailto,$subject,$newMsg,$headers);
}
if (!$sentMail) err("Cannot send email!");
if(!$incresults)
{
$addtoThank="";
}
if($thankyoupage)
{
header("Location: $thankyoupage");
}
else
{
print <<<__EOT__
Form Submitted
$thanksMsg
$addtoThank
$unregMsg