voorkomen van spam
Ik heb een eigen website al sinds lange tijd. Maar de laatste tijd krijg ik constant op mijn info@... allerlei spam dat naar alle waarschijnlijkheid van één server afkomt ondanks de verschillende mailadressen.
Zonder al te veel te verknoeien zou ik dit in mijn PHP-file willen aanbrengen om deze soort spam voorgoed te voorkomen.
Ik zal even die contact.php meesturen, zodat je weet dat ik alles goed wil behouden maar dan met toevoeging van die anti spam scripts.
Laat dan a.u.b. even zien binnen mijn contact.php. Het gaat dus niet om persoonlijke mail. Het gaat om die spam met name uit de States wat ik vermoed.
Hartelijk dank voor het advies.
Code (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require("header.php");
?>
<br>
<div class="wDiv3" align="center">
<img src="images/earth6.gif" border="0" align="left">
<br><br>
If you want to contact Peter, please contact the webmaster. See the contact formular hereunder.
<br>
Peter however says: "I'll try to reply your message anyway, if not, don't be disappointed,
<br>
because I'm glad that you contact me and are interested. Thanks anyway."
<br><br>
<p>Spammers and advertisers, do not send anything, you will be blocked. The webmaster.</p>
<br><br>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" name="contact_form">
<table width="100%" border="0">
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Name: </font></td>
<td><input name="name" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">E-mail address:
</font></td>
<td><input name="email" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Subject:
</font></td>
<td><input name="subject" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Your message</font></td>
<td><textarea name="message" cols="60" rows="10"></textarea> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td class="style66" colspan="2"><input type="checkbox" name="copy" value="true" /><align="left" valign="top"><font face="Arial" color="#191970" size="-1">Send a copy to yourself</font></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial">
<input type="reset" name="Reset" value="Reset">
</font></td>
<td><font face="Arial">
<input type="submit" name="Send" value="Send">
<p><img src="images/star.gif" alt="required field" align="absmiddle"> <font face="Arial" color="#191970" size="-1">= Required </font></p>
</font></td>
</tr>
</table>
</form>
<?php
if (isset($_POST['Send'])) {
$recipient = "**knip**";
$subject = stripslashes($_POST['Subject']) . ' <' . $_POST['subject'] . ">\n";
$header = "From:" . stripslashes($_POST['name']) . ' <' . $_POST['email'] . ">\n";
if (isset($_POST['copy']) && $_POST['copy'] == 'true') {
$header .= '' . $_POST['email'] ."\n";
}
$header .= "\n";
$mail_body = "The contact formular has been sent on " . date("d-m-Y \a\\t H:i") . " and executed.\n";
$mail_body .= "The next details have been filled in:\n\n";
$mail_body .= "Name: " . stripslashes($_POST['name']) . "\n";
$mail_body .= "E-mail address: " . $_POST['email'] . "\n\n";
$mail_body .= "Message: \n" . stripslashes($_POST['message']) . "\n";
$mail_body .= "\n\n -- End of the automatically generated message --";
mail($recipient, $subject, $mail_body, $header, '-f ' . $_POST['email']);
require("footer.php");
}
?>
require("header.php");
?>
<br>
<div class="wDiv3" align="center">
<img src="images/earth6.gif" border="0" align="left">
<br><br>
If you want to contact Peter, please contact the webmaster. See the contact formular hereunder.
<br>
Peter however says: "I'll try to reply your message anyway, if not, don't be disappointed,
<br>
because I'm glad that you contact me and are interested. Thanks anyway."
<br><br>
<p>Spammers and advertisers, do not send anything, you will be blocked. The webmaster.</p>
<br><br>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" name="contact_form">
<table width="100%" border="0">
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Name: </font></td>
<td><input name="name" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">E-mail address:
</font></td>
<td><input name="email" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Subject:
</font></td>
<td><input name="subject" type="text" size="40" checked> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial" color="#191970" size="-1">Your message</font></td>
<td><textarea name="message" cols="60" rows="10"></textarea> <img src="images/star.gif" alt="required field" align="absmiddle"></td>
</tr>
<tr>
<td class="style66" colspan="2"><input type="checkbox" name="copy" value="true" /><align="left" valign="top"><font face="Arial" color="#191970" size="-1">Send a copy to yourself</font></td>
</tr>
<tr>
<td align="left" valign="top"><font face="Arial">
<input type="reset" name="Reset" value="Reset">
</font></td>
<td><font face="Arial">
<input type="submit" name="Send" value="Send">
<p><img src="images/star.gif" alt="required field" align="absmiddle"> <font face="Arial" color="#191970" size="-1">= Required </font></p>
</font></td>
</tr>
</table>
</form>
<?php
if (isset($_POST['Send'])) {
$recipient = "**knip**";
$subject = stripslashes($_POST['Subject']) . ' <' . $_POST['subject'] . ">\n";
$header = "From:" . stripslashes($_POST['name']) . ' <' . $_POST['email'] . ">\n";
if (isset($_POST['copy']) && $_POST['copy'] == 'true') {
$header .= '' . $_POST['email'] ."\n";
}
$header .= "\n";
$mail_body = "The contact formular has been sent on " . date("d-m-Y \a\\t H:i") . " and executed.\n";
$mail_body .= "The next details have been filled in:\n\n";
$mail_body .= "Name: " . stripslashes($_POST['name']) . "\n";
$mail_body .= "E-mail address: " . $_POST['email'] . "\n\n";
$mail_body .= "Message: \n" . stripslashes($_POST['message']) . "\n";
$mail_body .= "\n\n -- End of the automatically generated message --";
mail($recipient, $subject, $mail_body, $header, '-f ' . $_POST['email']);
require("footer.php");
}
?>
Edit:
Ik heb code-tags geplaatst. Gelieve dit in het vervolg zelf toe te voegen aan je bericht. Quote is enkel bedoeld voor het citeren van tekst.
Zie ook: Veel gestelde vragen: Welke UBB-codes kan ik gebruiken.
Zie ook: Veel gestelde vragen: Welke UBB-codes kan ik gebruiken.
Gewijzigd op 28/01/2020 23:48:07 door - Ariën -
reCAPTCHA aan. Die werkt (in V3) aan de hand van een score waaraan de verstuurder voldoet. Als deze gelijk is aan 0.5 of hoger, dan is de verstuurder hoogstwaarschijnlijk geen spammer.
Ikzelf raad Gewijzigd op 28/01/2020 23:01:52 door - Ariën -
@Arien, haal dan gelijk even z'n emailadres uit het script anders krijgt ie nog meer spam.
Ah, geen slecht idee!