2012-07-24 83 views
0

有人可以幫我防垃圾郵件證明這個PHP腳本嗎?另外,當我使用這個腳本時,我收到兩封電子郵件,一封是空的,另一封是結果。整合電子郵件驗證

<?php 
    $to = "[email protected]"; 
    $subject = "Registrierung auf voodooCAST.de"; 
    $headers = "From: Form Mailer"; 
    $forward = 0; 
    $location = ""; 

    $date = date ("l, F jS, Y"); 
    $time = date ("h:i A"); 



    $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n"; 

    if ($_SERVER['REQUEST_METHOD'] == "POST") { 
     foreach ($_POST as $key => $value) { 
      $msg .= ucfirst ($key) ." : ". $value . "\n"; 
     } 
    } 
    else { 
     foreach ($_GET as $key => $value) { 
     $msg .= ucfirst ($key) ." : ". $value . "\n"; 
     } 
    } 

    mail($to, $subject, $msg, $headers); 
    if ($forward == 1) { 
     header ("Location:$location"); 
    } 
    else { 
     header('Location: http://www.voodoocast.de/confirm.php') ;  
    } 

?> 
+0

你是什麼意思「垃圾郵件證據」? – woz 2012-07-24 17:03:25

+0

垃圾郵件證明將意味着您只能輸入有效的電子郵件地址,並且無法將腳本插入到該表單或其他東西 – 2012-07-24 17:07:53

回答

0
在你的HTML

形成可以使用<input type="email"></input>,它會驗證自身

+0

如何解決我每次提交表單時都會收到2封電子郵件的問題? – 2012-07-24 17:17:30

+0

你可以添加你的'

'的代碼嗎? – 2012-07-24 17:20:33

+0

哪些變量會得到這些電子郵件? – 2012-07-24 17:21:31