Hi I have used this tutorial
http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/
to create php – jquery – ajax form , and now i have receiving empty form mails every day (2 emails every morning) even know, to access the page where the form is user needs first to login …
so how it can be that it send empty mails every day, from protected page …. /
The form has some checks to check if some fields are empty it does not send it … but still i am getting empty emails …
I thinking could it be some kind of web crawlers and bots to trigger this ? since it is always at the same time of the day, with no user logins and etc (it post user login info in mail, and it is empty in these mails)
Id it is these bots how to protect it ? if no – any other ideas why this could happen ?
Thanks
<?php
if ((isset($_POST['Firma'])) && (strlen(trim($_POST['Firma'])) > 0)) {
$Firma = stripslashes(strip_tags($_POST['Firma']));
}
if ((isset($_POST['Adresse'])) && (strlen(trim($_POST['Adresse'])) > 0)) {
$Adresse = stripslashes(strip_tags($_POST['Adresse']));
}
if ((isset($_POST['Telefon'])) && (strlen(trim($_POST['Telefon'])) > 0)) {
$Telefon = stripslashes(strip_tags($_POST['Telefon']));
}
if ((isset($_POST['PostNr'])) && (strlen(trim($_POST['PostNr'])) > 0)) {
$PostNr = stripslashes(strip_tags($_POST['PostNr']));
}
if ((isset($_POST['By'])) && (strlen(trim($_POST['By'])) > 0)) {
$By = stripslashes(strip_tags($_POST['By']));
}
if ((isset($_POST['Email'])) && (strlen(trim($_POST['Email'])) > 0)) {
$Email = stripslashes(strip_tags($_POST['Email']));
}
if ((isset($_POST['Fax'])) && (strlen(trim($_POST['Fax'])) > 0)) {
$Fax = stripslashes(strip_tags($_POST['Fax']));
}
if ((isset($_POST['Web'])) && (strlen(trim($_POST['Web'])) > 0)) {
$Web = stripslashes(strip_tags($_POST['Web']));
}
if ((isset($_POST['editorName'])) && (strlen(trim($_POST['editorName'])) > 0)) {
$editorName = stripslashes(strip_tags($_POST['editorName']));
}
if ((isset($_POST['editorMail'])) && (strlen(trim($_POST['editorMail'])) > 0)) {
$editorMail = stripslashes(strip_tags($_POST['editorMail']));
}
if ((isset($_POST['persons'])) && (strlen(trim($_POST['persons'])) > 0)) {
$persons = $_POST['persons'];
}
if ((isset($_POST['username'])) && (strlen(trim($_POST['username'])) > 0)) {
$username = $_POST['username'];
}
$personsname[] = array();
$personsmail[] = array();
$personsnews[] = array();
$personsmedelm[] = array();
ob_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> </title>
</head>
<body>
Firma : <?=$Firma;?><br/>
Adresse : <?=$Adresse;?><br/>
Telefon : <?=$Telefon;?><br/>
PostNr : <?=$PostNr;?><br/>
By : <?=$By;?><br/>
Email : <?=$Email;?><br/>
Fax : <?=$Fax;?><br/>
Web : <?=$Web;?><br/><br/><br/>
<?=$persons;?>
Redigeret af: <?=$editorName;?> - <?=$editorMail;?><br/>
Filled by : <?=$username;?>
</body>
</html>
<?php
$to = 'i@i.dk';
$email = 'i@i.dk';
$fromaddress = "i@i.dk";
$fromname = "i@i.dk";
require("phpmailer.php");
$mail = new PHPMailer();
$mail->From = "i@i.dk";
$mail->FromName = "i@i.dk";
$mail->AddAddress("i@i.dk","i.dk");
$mail->AddAddress("i@i.dk","i.dk");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->CharSet = "UTF-8";
$mail->Encoding = 'quoted-printable';
$mail->Subject = "Mail";
$mail->Body = $body;
$mail->AltBody = "This is the text-only body";
if($Firma != '' && $Firma != null){
if(!$mail->Send()) {
$recipient = 'i@i.dk';
$subject = 'Mail';
$content = $body;
mail($recipient, $subject, $content, "From: i@i.dk\r\nReply-To: i@i.dk\r\nX-Mailer: DT_formmail");
exit;
}
}
?>
If you have access to your server logs, check what user-agents have connected to your site at those times. Probably is some kind of a bot, that tries to access every URL listed in your page’s source (also the URL javascript POSTs to, to send you an email). I bet you have your validation only in Javascript and you have no captcha?