我有一个基本的php脚本,用于网络解决方案托管帐户上的联系表单,该帐户过去一直运行正常,直到NS将PHP从5.2.7升级到5.3.8。我收到的唯一消息是404:找不到页面。当我打电话给NS时,他们说这是我的剧本。但脚本是“未找到”。我错过了什么?我将不胜感激任何帮助。
我无法访问任何错误日志,但这里是脚本,也许你可以看看。非常感谢。另外需要注意的是OIS-MailingList.txt文件仍然被写入,即使单击提交按钮时它会显示“404:找不到页面”
<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="description" content="Orion Inspection Services provides the oil and gas industry with the most highly skilled and professional workforce available." />
<title>Orion Inspection Services | Contact Us</title>
</head>
<body>
<?php
if ((strlen($_POST['name']) < 3) || (strlen($_POST['your-phone']) < 5) || (strlen($_POST['your-email']) < 5) || (strlen($_POST['c-message']) < 5))
{
header('Location:http://orioninspection.com/Test/message-error.html');
}
else
{
$today = date('m-d-Y');
$filename = 'OIS-MailingList.txt';
$file = fopen($filename,'a+b');
echo fwrite($file,$today);
echo fwrite($file,',');
echo fwrite($file,$_POST['name']);
echo fwrite($file,',');
echo fwrite($file,$_POST['your-email']);
echo fwrite($file,',');
echo fwrite($file,$_POST['your-phone']);
echo fwrite($file,"\r\n");
header('Location:http://orioninspection.com/Test/message-success.html');
$headers = 'From: Orion Inspection Services <info@orioninspection.com>' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message .= '<b>OIS Customer Message</b><br /><br />';
$message .= '<b>Name:</b> ' . $_POST['name'] . '<br /><br />';
$message .= '<b>Email:</b> ' . $_POST['your-email'] . '<br /><br />';
$message .= '<b>Phone:</b> ' . $_POST['your-phone'] . '<br /><br />';
$message .= '<b>Message:</b> ' . $_POST['c-message'] . '<br /><br />';
$message = wordwrap($message, 70);
mail('info@orioninspection.com', 'OIS Customer Message', $message, $headers);
fclose($file);
}
?>
</body>
</html>
<?php ob_flush(); ?>
答案 0 :(得分:1)
更改重定向标题以指向正确的位置:
header('Location:http://orioninspection.com/message-error.html');
...
header('Location:http://orioninspection.com/message-success.html');