FEEDBACK
Please complete your details and then press Send Comments.
} ?>$mailto = "learning@filmaust.com.au" ; //$mailto = "thomas@ether.com.au" ; $subject = "On the Rails Feedback Form" ; //$formurl = "/users/feedback.php" ; //$errorurl = "/users/feedbackerror.php" ; //$thankyouurl = "/users/response.php" ; // -------------------- END OF CONFIGURABLE SECTION --------------- $isSubmitted = $_POST['isSubmitted'] ; $log = ""; $filename = 'spamlog.txt'; function analiseArray($value, $key){ global $log; $log .= "$key = $value\n"; } function appendLog($status){ global $log, $filename; array_walk($_POST, 'analiseArray'); $log .= date('l dS \of F Y h:i:s A') . " - $status"; $log .= "\n\n\n"; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { exit; } if (fwrite($handle, $log) === FALSE) { exit; } fclose($handle); } } if ($isSubmitted){ # do not process if replyto address is local - a common spambot ploy # this code block was added by thomas@ether.com.au in response to a spambot attack if (stristr($_POST['email'],'ontherails') != FALSE) { appendLog("SPAM ALERT - local address"); exit ; } # check email - this also seems to pick up most header injection attacks if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { appendLog("SPAM ALERT - malformed sender address, possible header injection attack"); exit; } $name = $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { appendLog("no POST variables sent"); exit ; } if (empty($name) || empty($email) || empty($comments)) { appendLog("MISSING FIELDS"); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" . $response ; $doSendMail = mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" ); if ($doSendMail){ appendLog("SUCCESSFUL - mail sent to $mailto"); $response = "
Thanks for your feedback!
"; } else { appendLog("ERROR - unspecified problem with mail command"); $response = "There was an error sending your message. Please try again later.
"; } } ?>