<?
$required_on = "no";
$required_errorpage = "error.html";
$override = "no";
$incoming_mailto = "moj_mail@gmail.com";
$ban_ip_on = "no";
$ban_ip_list = "";
$secure_domain_on = "yes";
$autorespond_on = "no";
$autorespond_subject = "Your Form Submission";
$autorespond_from = "youremail@yoursite.com";
$autorespond_contents = "Your submission from our website has been received. Thank you!";
$autorespond_mailto_field = "Email";
// MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL
if($HTTP_SERVER_VARS['REQUEST_METHOD'] == "GET") {
<html>
<head><title>DynaForm is installed correctly.</title></head>
<body>
<font style='font-family: verdana, arial; font-size: 9pt;'>
<b>DynaForm is installed correctly.</b></font>
</body></html>
";
}
// SET VARIABLES
if($override == "no") {
$incoming_mailto = @$HTTP_POST_VARS['rec_mailto'];
$incoming_subject = @$HTTP_POST_VARS['rec_subject'];
$incoming_thanks = @$HTTP_POST_VARS['rec_thanks'];
}
$incoming_mailto_cc = @$HTTP_POST_VARS['opt_mailto_cc'];
$incoming_mailto_bcc = @$HTTP_POST_VARS['opt_mailto_bcc'];
$form_url = @$HTTP_REFERER;
// MAKE SURE DYNAFORM IS BEING RUN FROM THE RIGHT DOMAIN
if($secure_domain_on == "yes") {
$form_domain = $form_url_array[host];
if($form_domain != $HTTP_SERVER_VARS[HTTP_HOST]) {
echo "<h2>DynaForm Error - Invalid Domain</h2> You have accessed DynaForm from an external domain - this is not allowed.<br>
You may only submit forms to a DynaForm file that exists on the same domain name
.<br>
If you believe to be receiving this message in error, please refer to your readm
e.txt file.
<br><br>";
$error = "yes";
}
}
// CHECK IF MAILTO IS SET
if($incoming_mailto == "") {
echo "<h2>DynaForm Error - Missing Field</h2> Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_mailto</b>\" field within the form. This field specifies who the email will
be sent to.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_mailto\" value=\"youremail@yoursite.com\">
<br><br>
If you are still confused, please refer to the readme.txt for more information a
nd examples.<br><br><br><br>
";
$error = "yes";
}
// CHECK IF SUBJECT IS SET
if($incoming_subject == "") {
echo "<h2>DynaForm Error - Missing Field</h2> Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_subject</b>\" field within the form. This field specifies the subject of
the email that will be sent.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_subject\" value=\"New DynaForm Email\">
<br><br>
If you are still confused, please refer to the readme.txt for more information a
nd examples.<br><br><br><br>
";
$error = "yes";
}
// CHECK IF THANKS IS SET
if($incoming_thanks == "") {
echo "<h2>DynaForm Error - Missing Field</h2> Your form located at <a href='$form_url'>$form_url</a> does not work because you forgot to include
the required \"<b>rec_thanks</b>\" field within the form. This field specifies what page the user
will be taken to after they submit the form.
<br><br>
This should look like:<br>
<input type=\"hidden\" name=\"rec_thanks\" value=\"thanks.html\">
<br><br>
If you are still confused, please refer to the readme.txt for more information a
nd examples.<br><br><br><br>
";
$error = "yes";
}
// CHECK IF IP ADDRESS IS BANNED
if($ban_ip_on == "yes") {
if(strstr($ban_ip_list, $HTTP_SERVER_VARS[REMOTE_ADDR
])) { echo "<h2>DynaForm Error - Banned IP</h2> You cannot use this form because your IP address has been banned by the administ
rator.<br>
";
$error = "yes";
}
}
if($error == "yes") {
}
// SET EMAIL INTRODUCTION
$message = "Ten mail zostal wyslany ze strony www.moja_strona.com.pl\n\n\n\n";
// LOAD EMAIL CONTENTS
for ($i = 0; $i < count($incoming_fields); $i++) { if($incoming_fields[$i] != "rec_mailto") {
if($incoming_fields[$i] != "rec_subject") {
if($incoming_fields[$i] != "rec_thanks") {
if($incoming_fields[$i] != "opt_mailto_cc") {
if($incoming_fields[$i] != "opt_mailto_bcc") {
// CHECK FOR REQUIRED FIELDS IF ACTIVATED
if($required_on == "yes") {
$sub = substr($incoming_fields[$i], 0
, 2
); if($sub == "r_") {
if($incoming_values[$i] == "" OR
!isset($incoming_values[$i]) OR
$incoming_values[$i] == " ") { header("Location: $required_errorpage"); }}}
// ADD FIELD TO OUTGOING MESSAGE
$message .= "$incoming_fields[$i]:\n$incoming_values[$i]\n\n";
}}}}}}
// SET EMAIL FOOTER
//$message .= "\n\nThank you for using our Webligo DynaForm script.\nWe ask that you pleas
e link back to our site if you have not already.\nYour use of DynaForm is subject
to the license agreement outlined in dynaform.php.\nVisit us at: http://www.webligo.com";
// CHECK FOR CC OR BCC
$headers = "";
if($incoming_mailto_cc != "") {
$headers .= "Cc: $incoming_mailto_ccr\n";
}
if($incoming_mailto_bcc != "") {
$headers .= "Bcc: $incoming_mailto_bccr\n";
}
// SEND EMAIL
mail($incoming_mailto, $incoming_subject, $message, $headers);
// SEND AUTO-RESPONSE IF ACTIVATED
if($autorespond_on == "yes") {
$autorespond_mailto = @$HTTP_POST_VARS[$autorespond_mailto_field];
$autorespond_headers = "From: $autorespond_from";
mail($autorespond_mailto, $autorespond_subject, $autorespond_contents, $autorespond_headers); }
// FORWARD TO THANK YOU PAGE
header("Location: $incoming_thanks");
?>