dppfxf909679 2013-11-21 17:37
浏览 70
已采纳

拒绝访问。 PHP脚本

I have a contact form, when submitting on my page says 'Access denied.' There is nothing else, so I can't seem to figure out how to debug.

Here is the code :

<?php

    $EmailFrom = "username@email.com";
    $EmailTo = "username@email.com, username2@email.com";
    $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 .= "
";
    $Body .= "Company: ";
    $Body .= $Company;
    $Body .= "
";
    $Body .= "Tel: ";
    $Body .= $Tel;
    $Body .= "
";
    $Body .= "Further comments: ";
    $Body .= $Message;
    $Body .= "
";

    // 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;
    }
?>

I'm not sure why it's not working, could someone shed some light on this?

  • 写回答

1条回答 默认 最新

  • dsv17139 2013-11-21 17:41
    关注

    The headers of the page you're submitting the form to are actually returning a HTTP 403 Forbidden error.

    I'd suggest checking the file permissions & ownership of the contactengine.php file are correct as a first step.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮