2013-11-21 124 views
-1

我有一個聯繫表單,在我的page上提交時表示'訪問被拒絕'。沒有別的,所以我似乎無法弄清楚如何調試。訪問被拒絕。 PHP腳本

下面是代碼:

<?php 

    $EmailFrom = "[email protected]"; 
    $EmailTo = "[email protected], [email protected]"; 
    $Subject = "Subject"; 

    $Name = Trim(stripslashes($_POST['Name'])); 
    $Company = Trim(stripslashes($_POST['Company'])); 
    $Email = Trim(stripslashes($_POST['Email'])); 
    $Tel = Trim(stripslashes($_POST['Tel'])); 

    $Message = Trim(stripslashes($_POST['Message'])); 

    // Validation 
    $validationOK = true; 
    if (! $validationOK) 
    { 
     print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; 
     exit; 
    } 

    // Prepare Email Body Text 
    $Body = ""; 
    $Body .= "Name: "; 
    $Body .= $Name; 
    $Body .= "\n"; 
    $Body .= "Company: "; 
    $Body .= $Company; 
    $Body .= "\n"; 
    $Body .= "Tel: "; 
    $Body .= $Tel; 
    $Body .= "\n"; 
    $Body .= "Further comments: "; 
    $Body .= $Message; 
    $Body .= "\n"; 

    // Send Email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); 

    // Redirect To Success Page 
    if ($success) 
    { 
     echo '<script>alert("Thanks for your message, somebody will get in touch with your shortly.");</script>'; 
     echo "<meta http-equiv=\"refresh\" content=\"0;URL=../contact\">"; 
    } 
    else 
    { 
     echo '<script>alert("There has been an error, please try again later.");</script>'; 
     echo '<script>history.back(1);</script>'; 
     exit; 
    } 
?> 

我不知道爲什麼它不工作,可能有人闡明這一些輕?

+2

請不要鏈接到實時代碼。它可以確保在修復實時代碼後您的問題沒有用處,從而不再出現問題。 – meagar

回答

1

您正在提交表單的頁面的標題實際上會返回HTTP 403 Forbidden錯誤。

我建議檢查文件權限& contactengine.php文件的所有權作爲第一步是正確的。

+0

乾杯,固定它 - 我認爲它自己改變是奇怪的... –