2014-12-31 258 views
0

我爲我的網站使用000webhost,他們一直在暫停我的帳戶,因爲我顯然發送的郵件超過1000封。這發生在通過我的聯繫表單提交電子郵件約30秒後。我只收到一封電子郵件,所有從表單發出的電子郵件都發給我,他們也不在我的垃圾郵件中。PHP表單故障

我只是想對這個表單是否實際上循環發送消息,但我沒有得到它們或這是000webhost故障的意見。自從我創建這個網站以來,我有一個聯繫表格,現在它是唯一的問題。

繼承人的聯繫表格代碼:

<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<link rel="stylesheet" href="CSS/primary.css"> <!--Address Using URL to prevent no styling when slash is typed--> 
<link rel="shortcut icon" href="Images/tabIcon.ico"> 
<title>Harry Felton | Welcome</title> 
</head> 
<script language="php"> 
    require_once'header.php'; 
</script> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<script> 
    $('body').hide() 
    $("#notify").hide() 
</script> 
<script> 
    function toggleAbout(){ 
     if ($("#center").hasClass("up")) { 
      $("#about").slideToggle(500); 
      setTimeout(function() { 
       $("#center").css({ 
        msTransform: 'translateY(10px)', 
        webkitTransform: 'translateY(10px)', 
        transform: 'translateY(10px)', 
       }) 
      }, 500); 
     } else { 
      $("#center").css({ 
       msTransform: 'translateY(-75px)', 
       webkitTransform: 'translateY(-75px)', 
       transform: 'translateY(-75px)', 
      })  
      setTimeout(function() { 
      $("#about").slideToggle(500); 
     }, 1000); 

     } 
     $($("#center").toggleClass("up")) 
    }; 
</script> 
<body onunload="" class="pg-index"> 
    <div class="overwrap"> 
     <div id="center"> 
      <h1 id="title1">Welcome</h1> 
      <h2 id="title2">Harry Felton</h2> 
      <h2 id="subTitle">Auckland | New Zealand</h2> 
      <br><br><br><br> 
      <div id="about" style="display: none;"> 
       <p>Hi, My name is Harry and I am an amateur programmer, I just do it as a hobby until I can actually take it as a course, I have created many programs, and love doing it, I am also into ComputerCraft which is a mod for Minecraft that adds programmable computers.<br><br>This website domain was initially created around September 2014, It took about a week to create, It was awesome, As it was the first time I had ever used HTML, CSS or JavaScript. On the 20th November I chose to completely recreate the website, So I deleted all files, And now... Here we are.<br><br>My absolute favorite thing to do in this world is code, I enjoy making, distributing and using my programs, And the feedback is always awesome, If you feel like leaving feedback, then click HERE</p> 
      </div> 
     </div> 
     </div> 
     <script type="text/javascript" src="JavaScript/element.js"></script> 
     <script type="text/javascript" src="JavaScript/pageNav.js"></script> 
     <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> 
     <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script> 
     <div id="contactForm" class="hidden"> 
      <title>Contact Us</title> 
      <div id="mainPageCont"> 
      <?php error_reporting(0); ?> 
      <?php if(isset($_POST['Email'])): ?> 
       <?php 
       $to  = '[email protected]'; 
       $subject = 'ALERT! Website Form Submission'; 
       $message = 'Users Name: '.strip_tags($_POST['Name'])."\n"; 
       $message .= 'Users Email: '.strip_tags($_POST['Email'])."\n"; 
       $message .= 'Submitted Message: '.strip_tags($_POST['Comment'])."\n"; 
       $headers = 'From: [email protected]' . "\r\n" . 
        'Reply-To: '.strip_tags($_POST['Email']) . "\r\n"; 
       ?> 
       <?php if(mail($to, $subject, $message, $headers)): ?> 
       <script type="text/javascript"> 
        console.log('Mail OK') 
        location.href="/" 
       </script> 
       <?php endif ?> 
      <?php else: ?> 
      <script>console.log('Loading Contact Script')</script> 
      <form method="post" id="comments_form"> 
       <h2>Please Leave Some Feedback, It Helps!</h2> 
       <div class="row"> 
        <div class="label"> 
         Your Name 
        </div> 
        <!--.label end--> 
        <div class="input"> 
         <input type="text" id="fullname" class="detail" name="Name" 
          value="<?php echo isset($_POST['Name'])? $_POST['Name'] : ''; ?>" placeholder="e.g John Doe"/> 
        </div> 
        <!--.input end--> 
        <div class="context"> 
         <span>We want to know who we are talking too</span> 
        </div> 
        <!--end .context--> 
       </div> 
       <!--.row end--> 

       <div class="row"> 
        <div class="label"> 
         Your Email 
        </div> 
        <!--.label end--> 
        <div class="input"> 
         <input type="text" id="email" class="detail" name="Email" placeholder="e.g [email protected]" value="<?php echo isset($_POST['Email'])? $_POST['Email'] : ''; ?>" /> 
        </div> 
        <!--.input end--> 
        <div class="context"> 
         <span>We will send an email to this address containing a confirmation and any further replies</span> 
        </div> 
        <!--end .context--> 
       </div> 
       <!--.row end--> 
       <div class="row"> 
        <div class="label"> 
         Your Message 
        </div> 
        <!--.label end--> 
        <div class="input2"> 
         <textarea id="Comment" name="Comment" class="mess"><?php echo isset($_POST['Comment'])? $_POST['Comment'] : ''; ?></textarea> 
        </div> 
        <!--.input end--> 
       </div> 
       <!--.row end--> 

       <div class="submit"> 
        <input type="submit" id="submit" name="Submit" value="Send Message" /> 
       </div> 
      </form> 
      <?php endif; ?> 
      <script> 
      function CheckVal() { 
       var SetMess = $('#option').val(); 
       $('#feedback').html(SetMess); 

       if (SetMess !== '') { 
         $('#submit').prop('disabled', false); 
        } 
       else { 
         $('#submit').prop('disabled', true); 
        } 
      } 
      // As one types, check that the message is not empty 
      $('#option').keyup(function() { 
       CheckVal(); 
      }); 
      // As one clicks into the field, see if it has content 
      $('#option').click(function() { 
       CheckVal(); 
      }); 

        $(document).ready(function() { 
         // validate form 
         $("#comments_form").validate({ 
          // This will allow you to extend the validator functions 
          invalidHandler: 
            function(form, validator) { 
             // $("#get_online").val("CHECK"); 
           }, 
          rules: { 
           // For every named input that you want to validate, 
           // you create a little set of prefs 
           Name: { 
            required: true, 
           }, 
           Email: { 
              required: true, 
              email: true 
             }, 
           Comment: { required: true }, 
           }, 
          messages: { 
            // Here are just the custom messages you can modify per field 
            Name: { 
              required: 'Please Enter Your Name', 
             }, 
            Email: { 
              required: 'Please Enter An Email', 
              email: 'Email address not valid', 
             }, 
            Comment: { required: 'Please Enter A Message'}, 
           }, 
         }); 
        }); 
      </script> 
      </div> 
     </div> 
    </div> 
    <script> 
     $(document).ready(function() { 
      fadeIn("body"); 
      setTimeout(function() { 
       notification(); 
      }, 500) 
     }); 
    </script> 
<script>changeWelcome("#title1");</script> 

    <div id="notify">Disabled JavaScript Is Now Supported, Contact Form Is Being Worked On Again!<a onclick="notification();" id="notifyClose">x</a></div>  
    <script> 
     function notification() { 
      isNotify = true 
      notifyID = "#notify" 
      if (isNotify) { 
       if ($(notifyID).hasClass("vis")) { 
        console.log("Notification Bar Enabled, Hiding: "+notifyID); 
        $(notifyID).slideUp(500);    
       } else { 
        $(notifyID).slideDown(500); 
        console.log("Notification Bar Enabled, Showing: "+notifyID); 
       } 
       $(notifyID).toggleClass("vis"); 
      } 
     } 
    </script> 
</body> 
</html> 

如果你們想訪問網站,然後繼承人的鏈接:http://www.harryfelton.host56.com/雖然它可能是脫機因帳戶被暫停。

那麼......你覺得這是發送1000封電子郵件的循環嗎?我一直在做一些控制檯和警報測試,它似乎從來不會多次發送消息,但我想也許暫停時間有影響。

+0

你可以發佈header.php的內容嗎?在初步檢查時,我沒有看到一個循環......但是想知道那個文件裏有什麼。 – Mooseknuckles

回答

0

我認爲如果有人在瀏覽器中禁用javascript,他們可能會繞過您的jQuery驗證併發送1000封電子郵件,因爲您未驗證Reply-To電子郵件服務器端。

試着改變你的服務器端驗證的東西,如:

$to  = '[email protected]'; 
$subject = 'ALERT! Website Form Submission'; 
$message = 'Users Name: '.strip_tags($_POST['Name'])."\n"; 
$message .= 'Users Email: '.strip_tags($_POST['Email'])."\n"; 
$message .= 'Submitted Message: '.strip_tags($_POST['Comment'])."\n"; 
$headers = 'From: [email protected]' . "\r\n" . 
       'Reply-To: '.strip_tags($_POST['Email']) . "\r\n"; 

// User the filter_var() function to check that there is no manipulation 
// of the $headers 
if(filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) { 
     if(mail($to, $subject, $message, $headers)) { ?> 
      <script type="text/javascript"> 
       console.log('Mail OK') 
       location.href="/" 
      </script> 
<?php } 
    } ?> 

我沒有看到任何循環,從您發佈的內容。除了服務器端驗證之外,我沒有看到它應該發送1000封電子郵件的任何理由。

+0

嗯,雖然窗體不是可見的,如果他們沒有JavaScript,它通過另一個文件中的JavaScript函數顯示。即使他們也是,我還會收到一條消息嗎? – Harry

+0

就像它隱藏在樣式表中'class =「hidden」'? – Rasclatt

+0

是的,這是否阻止它被提交?如果不是,那麼其他問題可能會導致這種情況 – Harry