gpt4 book ai didi

javascript - 有人如何能够发送此消息? (邮件过滤问题)

转载 作者:行者123 更新时间:2023-12-02 20:29:51 24 4
gpt4 key购买 nike

我有点困惑,并且越来越担心。我在此实时网站上找到了一份电子邮件通讯注册表单: http://rattletree.com/

请注意,如果您转到那里,并尝试单击发送而不输入至少一些值,您会收到一条错误消息。另外,在这种情况下我没有收到电子邮件。我能够收到电子邮件的唯一方法是输入一些值。但由于某种原因,我偶尔会收到发送给我的包含空值的电子邮件。它非常断断续续,我认为这是某个机器人以某种方式通过了我的过滤器,但我真的很想知道这是如何发生的?

这是代码:

<div class="outeremailcontainer">

<div id="emailcontainer">
<form action="index_success.php" method="post" id="sendEmail" class="email">
<h3 class="register2">Newsletter Signup:</h3>
<ul class="forms email">
<li class="name"><label for="yourName">Name: </label>
<input type="text" name="yourName" class="info" id="yourName" value="" /><br />
</li>

<li class="city"><label for="yourCity">City: </label>
<input type="text" name="yourCity" class="info" id="yourCity" value="" /><br />
</li>

<li class="email"><label for="emailFrom">Email: </label>
<input type="text" name="emailFrom" class="info" id="emailFrom" value="" />
</li>

<li class="buttons email">

<button type="submit" id="submit">Send</button>
<input type="hidden" name="submitted" id="submitted" value="true" />
</li>

</ul>
</form>
<div class="clearing">

<script type="text/javascript">
$(document).ready(function(){

$('#emailFrom')
.focus(function(){
if ($('#overlay').length) { return; } // don't keep adding overlays if one exists
$('#sendEmail')

.find('.name, .city').slideDown(300, function(){ $(this).show(); });
$('.outeremailcontainer').css({ position: 'relative', bottom: 0, left: 0, zIndex : 1001 });
$('<div id="overlay"></div>').appendTo('body');
});

$('#overlay').live('click', function(){
$('#sendEmail')
.css({ backgroundColor : 'transparent' })
.find('.name, .city').slideUp(300);
$('.outeremailcontainer').css({ position : 'static' });
$('#overlay').remove();
});

});
</script>

这是电子邮件验证:

    $(document).ready(function(){

$('#emailFrom')
.focus(function(){
if ($('#overlay').length) { return; } // don't keep adding overlays if one exists
$('#sendEmail')

.find('.name, .city').slideDown(300, function(){ $(this).show(); });
$('.outeremailcontainer').css({ position: 'relative', bottom: 0, left: 0, zIndex : 1001 });
$('<div id="overlay"></div>').appendTo('body');
});

$('#overlay').live('click', function(){
$('#sendEmail')
.css({ backgroundColor : 'transparent' })
.find('.name, .city').slideUp(300);
$('.outeremailcontainer').css({ position : 'static' });
$('#overlay').remove();
});

});

$(document).ready(function(){
$("#submit").click(function(){
$(".error").hide();
var hasError = false;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;


var emailFromVal = $("#emailFrom").val();

if(emailFromVal == '') {
$("#emailFrom").after('<span class="error">You forgot to enter the email address to send from.</span>');
hasError = true;

} else if(!emailReg.test(emailFromVal)) {
$("#emailFrom").after('<span class="error">Enter a valid email address to send from.</span>');
hasError = true;
}

var yourNameVal = $("#yourName").val();
if(yourNameVal == '') {
$("#yourName").after('<span class="error">You forgot to enter your name.</span>');
hasError = true;
}

var yourCityVal = $("#yourCity").val();
if(yourCityVal == '') {
$("#yourCity").after('<span class="error">You forgot to enter your city.</span>');
hasError = true;
}
if(hasError == false) {
$(this).hide();
$("#sendEmail li.buttons").append('<img src="/wp-content/themes/default/images/template/loading.gif" alt="Loading" id="loading" />');
$.post("/includes/sendemail.php",
//emailTo: emailToVal,
{ emailFrom: emailFromVal, yourName: yourNameVal, yourCity: yourCityVal },
function(data){
$("#sendEmail").slideUp("normal", function() {
$("#sendEmail").before('<h3 class="register2">Success!</h3><p class="emailbox">You are on the Newsletter email list.</p>');
});
}
);
}
return false;
});
});

最佳答案

您的验证基于 JavaScript。大多数机器人不使用 JavaScript,因为它们对动态内容不感兴趣。作为测试,我使用 NoScript 禁用了 JavaScript,并且能够在不输入任何内容的情况下提交表单。

永远不要相信您的客户端,您应该在服务器上进行验证,并在输入无效时提供错误页面。

关于javascript - 有人如何能够发送此消息? (邮件过滤问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4355413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com