2013-04-07 46 views
0

從我的網站上填寫的所有突然聯繫表格都從1970年1月1日進入我的收件箱。來自php的聯繫方式的日期有誤

它們在我的收件箱的底部結束了,我已經錯過了一些線索......

任何想法如何能開始發生突然的?

我用我的聯繫頁面上的代碼是: -

<?php 
if(isset($_POST['email'])) { 

// EDIT THE 2 LINES BELOW AS REQUIRED 
$email_to = "my email address"; 
$email_subject = "Website Contact Enquiry"; 


function died($error) { 
    // your error code can go here 
    echo "We are very sorry, but there were error(s) found with the form you submitted.  "; 
    echo "These errors appear below.<br /><br />"; 
    echo $error."<br /><br />"; 
    echo "Please go back and fix these errors.<br /><br />"; 
    die(); 
} 

// validation expected data exists 
if(!isset($_POST['name']) || 
    !isset($_POST['email']) || 
    !isset($_POST['tel']) || 
    !isset($_POST['message'])|| 
    !isset($_POST['formtype']) 
    ) { 
    died('We are sorry, but there appears to be a problem with the form you submitted.');  
} 

$name = $_POST['name']; // required 
$email_from = $_POST['email']; // required 
$tel = $_POST['tel']; // required 
$message = $_POST['message']; // required 
$formtype = $_POST['formtype']; 


$email_message = "Form details below.\n\n"; 

function clean_string($string) { 
    $bad = array("content-type","bcc:","to:","cc:","href"); 
    return str_replace($bad,"",$string); 
} 

$email_message .= "Name: ".clean_string($name)."\n"; 
$email_message .= "Email: ".clean_string($email_from)."\n"; 
$email_message .= "Tel: ".clean_string($tel)."\n"; 
$email_message .= "Message: ".clean_string($message)."\n"; 
$email_message .= "formtype: ".clean_string($formtype)."\n"; 

// create email headers 
$headers = 'From: '.$email_from."\r\n". 
'Reply-To: '.$email_from."\r\n" . 
'X-Mailer: PHP/' . phpversion().date(); 
@mail($email_to, $email_subject, $email_message, $headers); 
?> 

回答