if (!CheckEmail($FTGemail, kMandatory)) { $FTGErrorMessage['email'] = 'enter your email address properly'; $validationFailed = true; } # Include message in error page and dump it to the browser if ($validationFailed === true) { $errorPage = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Errors found: <!--VALIDATIONERROR--></body></html>'; $errorList = @implode("<br />\n", $FTGErrorMessage); $errorPage = str_replace('<!--VALIDATIONERROR-->', $errorList, $errorPage); echo $errorPage; } if ($validationFailed === false) { # Email to Form Owner $emailSubject = FilterCChars("contact_form"); $emailBody = "fullname : {$FTGfullname}\n" . "email : {$FTGemail}\n" . "subject : {$FTGsubject}\n" . "message : {$FTGmessage}\n" . ""; $emailTo = 'contact_form <*****@*****.**>,contact_form <*****@*****.**>'; $emailFrom = FilterCChars("*****@*****.**"); $emailHeader = "From: {$emailFrom}\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Include message in the success page and dump it to the browser $successPage = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Success</title></head><body>Form submitted successfully. It will be reviewed soon.</body></html>'; echo $successPage; } //redirect back $redirect_back = $_SERVER['HTTP_REFERER']; ?> <meta http-equiv="refresh" content="3;url=<?php echo $redirect_back; ?> " />
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } $FTGname = DoStripSlashes($_REQUEST['name']); $FTGmob = DoStripSlashes($_REQUEST['mob']); $FTGemailid = DoStripSlashes($_REQUEST['emailid']); $FTGenquiry = DoStripSlashes($_REQUEST['enquiry']); $FTGbutton = DoStripSlashes($_REQUEST['button']); $FTGbutton2 = DoStripSlashes($_REQUEST['button2']); # Fields Validations $ValidationFailed = false; if (!check_email($FTGemailid, kMandatory)) { $ValidationFailed = true; } # Redirect user to the error page if ($ValidationFailed === true) { header("Location: index.html"); exit; } # Email to Form Owner $emailSubject = FilterCChars("IDEE Enquiry"); $emailBody = "name : {$FTGname}\n" . "mob : {$FTGmob}\n" . "emailid : {$FTGemailid}\n" . "enquiry : {$FTGenquiry}\n" . ""; $emailTo = '*****@*****.**'; $emailFrom = FilterCChars("{$FTGemailid}"); $emailHeader = "From: {$emailFrom}\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: thanks.html"); exit;
$errorPage = str_replace('<!--FIELDVALUE:send-->', $FTGsend, $errorPage); $errorPage = str_replace('<!--FIELDVALUE:clear-->', $FTGclear, $errorPage); $errorPage = str_replace('<!--ERRORMSG:email2-->', $FTGErrorMessage['email2'], $errorPage); $errorList = @implode("<br />\n", $FTGErrorMessage); $errorPage = str_replace('<!--VALIDATIONERROR-->', $errorList, $errorPage); if (count(array_filter($FTGErrorMessage)) > 0) { $alertJSErrorMessage = "window.alert('" . @implode('\\n', str_replace("'", "\\'", array_filter($FTGErrorMessage))) . "');"; $onloadPattern = '/(<body[^>]+onload=[\\"]*)"([^>]*)>/i'; if (preg_match($onloadPattern, $errorPage)) { $replacementPattern = '\\1"' . $alertJSErrorMessage . '\\2>'; $errorPage = preg_replace($onloadPattern, $replacementPattern, $errorPage); } else { $onloadPattern = '/(<body[^>]*)>/i'; $replacementPattern = '\\1 onload="' . $alertJSErrorMessage . '">'; $errorPage = preg_replace($onloadPattern, $replacementPattern, $errorPage); } } echo $errorPage; } if ($validationFailed === false) { # Email to Form Owner $emailSubject = FilterCChars("Solar Decathlon Inquiry"); $emailBody = "name : {$FTGname}\n" . "email : {$FTGemail}\n" . "message : {$FTGmessage}\n" . ""; $emailTo = 'Webmaster <*****@*****.**>'; $emailReplyTo = FilterCChars("{$FTGemail}"); $emailFrom = 'No Reply <*****@*****.**>'; $emailHeader = "Reply-To: {$emailReplyTo}\n" . "From: {$emailFrom}\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: about-contacts.html?thanks"); }