forked from mccarthy/phpFormProtect
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact-process.php
More file actions
41 lines (36 loc) · 1.29 KB
/
contact-process.php
File metadata and controls
41 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
$recipient="you@example.com";
$subject="Website Form Submission";
if ($email=="") $email=$recipient;
include ('phpfp/class.FormProtect.php');
$fp = new FormProtect;
$fpResult = $fp->testSubmission($_POST);
echo '<a href="contact.php">Submit Form Again</a>';
$debugInfo = $fp->formatDebugInfo($_POST, $fpResult);
echo $debugInfo;
if($fpResult[pass]) {
//echo "Passed. Process as normal, send email, etc.";
if ($subject=="") $subject="[phpFromProtect: Pass] Form Submission";
$message = "Email: ".$email."<br />";
$message .= "Phone: ".$phone."<br />";
$message .= "Comments: ".$comments."<br />";
$message .= "Sender IP: ".$REMOTE_ADDR."<br /><br />";
$message .= $debugInfo;
$headers .= "Return-path: ".$recipient."\n";
$headers = "From: $email\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($recipient,$subject,$message,$headers);
}
else {
//echo "Failed. Log, block IP, email, etc.";
if ($subject=="") $subject="Form Submission";
$message = $debugInfo;
$subject = "[phpFromProtect: Fail] " . $subject;
$headers = "From: $email\n";
$headers .= "Return-path: ".$recipient."\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($recipient,$subject,$message,$headers);
}
?>