-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhoney-filter.php
55 lines (44 loc) · 1.28 KB
/
honey-filter.php
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
define('SECURITY_HASH', '8f3937426a12d221d56ea15901b5870d');
if (!isset($_POST['mauticform']) ||
!isset($_POST['mauticform']['formId']) ||
!isset($_POST['mauticform']['formName']) ||
!isset($_POST['mauticform']['amail']) ||
!isset($_POST['mauticform']['email'])) {
die('Required fields not set');
}
$fields = $_POST['mauticform'];
$formId = $fields['formId'];
$formName = $fields['formName'];
$realEmail = $fields['amail'];
$honeyEmail = $fields['email'];
$formUrl = "https://mautic.targetteal.com/form/submit?formId=$formId";
if ($honeyEmail != '') {
// Bot caught in the honeypot filter
die('Caught!');
}
$blockedEmailPatterns = array(
'/\A(\d*)\@(.*)\z/',
'/\A(.*)\@(\d*)\.(.*)\z/'
);
foreach ($blockedEmailPatterns as $pattern) {
if (preg_match($pattern, $realEmail)) {
// Bot caught in the blocked patterns
die('Caught');
}
}
$fields['email'] = $realEmail;
$fields['hash'] = SECURITY_HASH;
unset($fields['amail']);
?>
<p>Filtering Spam content... </p>
<form id="form" action="<?php echo $formUrl; ?>" method="post">
<?php
foreach ($fields as $name => $value) {
echo '<input type="hidden" name="mauticform[' . htmlentities($name) . ']" value="'.htmlentities($value).'"/>';
}
?>
</form>
<script type="text/javascript">
document.getElementById('form').submit();
</script>