我刚刚在线迁移了一个网站,目前正在网上进行测试,以确保一切正常。在几个特定页面上,当我提交时,我得到403禁止错误,而不是提交,我在localhost中没有看到。它们可能是什么原因?
错误
禁止
您无权访问此服务器上的/cms/CMShome.php。
此外,尝试使用ErrorDocument处理请求时遇到403 Forbidden错误。
给我错误的代码示例:
if ($_POST) {
if (isset($_POST['homesavebtn'])){
$home_title = (isset($_POST['home_title']) ? $_POST['home_title'] : null);
$home_text = (isset($_POST['home_text']) ? $_POST['home_text'] : null);
include 'connect.php';
$stmt = $conn->prepare("INSERT INTO content(name, fieldcontent)
VALUES ('home_title', ?), ('home_text', ?)
ON DUPLICATE KEY UPDATE fieldcontent = VALUES(fieldcontent)");
$stmt->bind_param('ss', $home_title, $home_text);
$stmt->execute();
$conn->close();
}
}
代码没有给我错误:
if ($_POST) {
else if(isset($_POST['update_contact'])) {
$contact_title = (isset($_POST['contact_title']) ? $_POST['contact_title'] : null);
$contact_email = (isset($_POST['contact_email']) ? $_POST['contact_email'] : null);
$contact_para1 = (isset($_POST['contact_para1']) ? $_POST['contact_para1'] : null);
$contact_para2 = (isset($_POST['contact_para2']) ? $_POST['contact_para2'] : null);
$address = (isset($_POST['address']) ? $_POST['address'] : null);
$contact_sub = (isset($_POST['contact_sub']) ? $_POST['contact_sub'] : null);
include 'connect.php';
$stmt = $conn->prepare("INSERT INTO content(name, fieldcontent) VALUES ('contact_title', ?), ('contact_email', ?), ('contact_para1', ?), ('contact_para2', ?), ('address', ?), ('contact_sub', ?) ON DUPLICATE KEY UPDATE fieldcontent = VALUES(fieldcontent)");
$stmt->bind_param('ssssss', $contact_title, $contact_email, $contact_para1, $contact_para2, $address, $contact_sub);
$stmt->execute();
$conn->close();
}
}