2010-12-04 25 views
0

私は少し混乱し、ますます懸念されています。 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-\.][email protected]([\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; 
    }); 
}); 
+0

index_success.phpの内容を教えてください。ボットはフォームの内容を解析し、フォームのターゲットに迷惑メールを送信することによってフォームを完全にバイパスしている可能性があります。 – MrGomez

+0

あなたが投稿したコードに実際の検証はありません。それにもかかわらず、検証がJavascriptで実行されている場合は、Javascriptを無効にするだけで簡単に実行できます。 –

+0

calmh、あなたは54秒で私にそれを打つ。しかたがない。あなたはこの障害について正しいです。 – user494085

答えて

2

あなたの検証は、Javaに基づいていますスクリプト。 ほとんどのボットは動的コンテンツには興味がないので、JavaScriptは使用しません。テストとして、NoScriptでJavaScriptを無効にして、何も入力せずにフォームを送信できました。

クライアントを信頼しないでください。入力が無効な場合は、サーバーで検証を行い、エラーページを提供する必要があります。

+0

+1。正確にここの問題。 – MrGomez

+0

メールは私に届いていないので、実際に送ったものは何もありません。 – Joel

0

これは簡単です - エンドユーザーは単にJavaScriptを無効にするか、多くの開発者プラグインの1つを使用して検証を無効/微調整します。

このような形式を使用すると、は、効果的なソリューションのためにサーバー側の検証に依存する必要があります。

+0

上記のコメントをご覧ください... – Joel

0

すべての上にフィールドバリデーターを置いておきたい場合があります。この非常に良いjQueryプラグインValidationには、電子メールを検証するための特定のハンドラがあります。ここでそれをチェックアウト:http://docs.jquery.com/Plugins/validation

は、電子メールの検証、例えば、として、簡単だろう:

$("#sendMail").validate({ 
     rules: { 
      "emailFrom":{ 
       email:true 
      } 
     } 
    }); 
関連する問題