您无权访问此服务器上的 /admin/add.php
You don't have permission to access /admin/add.php on this server
我的代码在本地主机上工作正常,但在服务器上传后出现此错误 -> 禁止
您无权访问此服务器上的 /admin/add.php。
此外,在尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误。
搜索了一下,但也没有在 fb grps 中找到合适的解决方案。还有一件事,根文件夹中没有 .htaccess 文件。尝试在服务器中添加 .htaccess 文件,但效果不佳。我在 textarea 中使用 summernote 之前我使用 tinymce 但得到同样的错误。它在没有 summernote/tinymce 的情况下工作正常。 textarea 类型是 mediumtext
add.php
<?php
include_once('../includes/config.php');
//if form has been submitted process it
if(isset($_POST['submit'])){
$_POST = array_map( 'stripslashes', $_POST );
//collect form data
extract($_POST);
//very basic validation
if($category_id ==''){
$error[] = 'Please select the category id.';
}
if($cam_unique_id ==''){
$error[] = 'Please enter the cam unique id.';
}
if($cam_features ==''){
$error[] = 'Please enter cam feature.';
}
if(!isset($error)){
try {
//insert into database
$stmt = $db->prepare('INSERT INTO cam_details (category_id,subcategory_id,cam_unique_id,cam_name,brand,cam_features,cam_spec_t1,cam_spec_t2,cam_spec_t3,cam_spec_t4,cam_spec_t5,cam_spec_t6,cam_spec1,cam_spec2,cam_spec3,cam_spec4,cam_spec5,cam_spec6) VALUES
(:category_id, :subcategory_id, :cam_unique_id, :cam_name, :brand, :cam_features, :cam_spec_t1, :cam_spec_t2, :cam_spec_t3, :cam_spec_t4, :cam_spec_t5, :cam_spec_t6,:cam_spec1, :cam_spec2, :cam_spec3, :cam_spec4, :cam_spec5, :cam_spec6)') ;
$stmt->execute(array(
':category_id' => $category_id,
':subcategory_id' => $subcategory_id,
':cam_unique_id' => $cam_unique_id,
':cam_name' => $cam_name,
':brand' => $brand,
':cam_features' => $cam_features,
':cam_spec_t1' => $cam_spec_t1,
':cam_spec_t2' => $cam_spec_t2,
':cam_spec_t3' => $cam_spec_t3,
':cam_spec_t4' => $cam_spec_t4,
':cam_spec_t5' => $cam_spec_t5,
':cam_spec_t6' => $cam_spec_t6,
':cam_spec1' => $cam_spec1,
':cam_spec2' => $cam_spec2,
':cam_spec3' => $cam_spec3,
':cam_spec4' => $cam_spec4,
':cam_spec5' => $cam_spec5,
':cam_spec6' => $cam_spec6
));
//redirect to index page
header('Location: index.php');
exit;
} catch(PDOException $e) {
echo $e->getMessage();
}
}
}
//check for any errors
if(isset($error)){
foreach($error as $error){
echo '<p class="error">'.$error.'</p>';
}
}
?>
尝试在管理目录中添加 includes 文件夹并将编码更改为
include_once('includes/config.php');
我的代码在本地主机上工作正常,但在服务器上传后出现此错误 -> 禁止
您无权访问此服务器上的 /admin/add.php。 此外,在尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误。
搜索了一下,但也没有在 fb grps 中找到合适的解决方案。还有一件事,根文件夹中没有 .htaccess 文件。尝试在服务器中添加 .htaccess 文件,但效果不佳。我在 textarea 中使用 summernote 之前我使用 tinymce 但得到同样的错误。它在没有 summernote/tinymce 的情况下工作正常。 textarea 类型是 mediumtext
add.php
<?php
include_once('../includes/config.php');
//if form has been submitted process it
if(isset($_POST['submit'])){
$_POST = array_map( 'stripslashes', $_POST );
//collect form data
extract($_POST);
//very basic validation
if($category_id ==''){
$error[] = 'Please select the category id.';
}
if($cam_unique_id ==''){
$error[] = 'Please enter the cam unique id.';
}
if($cam_features ==''){
$error[] = 'Please enter cam feature.';
}
if(!isset($error)){
try {
//insert into database
$stmt = $db->prepare('INSERT INTO cam_details (category_id,subcategory_id,cam_unique_id,cam_name,brand,cam_features,cam_spec_t1,cam_spec_t2,cam_spec_t3,cam_spec_t4,cam_spec_t5,cam_spec_t6,cam_spec1,cam_spec2,cam_spec3,cam_spec4,cam_spec5,cam_spec6) VALUES
(:category_id, :subcategory_id, :cam_unique_id, :cam_name, :brand, :cam_features, :cam_spec_t1, :cam_spec_t2, :cam_spec_t3, :cam_spec_t4, :cam_spec_t5, :cam_spec_t6,:cam_spec1, :cam_spec2, :cam_spec3, :cam_spec4, :cam_spec5, :cam_spec6)') ;
$stmt->execute(array(
':category_id' => $category_id,
':subcategory_id' => $subcategory_id,
':cam_unique_id' => $cam_unique_id,
':cam_name' => $cam_name,
':brand' => $brand,
':cam_features' => $cam_features,
':cam_spec_t1' => $cam_spec_t1,
':cam_spec_t2' => $cam_spec_t2,
':cam_spec_t3' => $cam_spec_t3,
':cam_spec_t4' => $cam_spec_t4,
':cam_spec_t5' => $cam_spec_t5,
':cam_spec_t6' => $cam_spec_t6,
':cam_spec1' => $cam_spec1,
':cam_spec2' => $cam_spec2,
':cam_spec3' => $cam_spec3,
':cam_spec4' => $cam_spec4,
':cam_spec5' => $cam_spec5,
':cam_spec6' => $cam_spec6
));
//redirect to index page
header('Location: index.php');
exit;
} catch(PDOException $e) {
echo $e->getMessage();
}
}
}
//check for any errors
if(isset($error)){
foreach($error as $error){
echo '<p class="error">'.$error.'</p>';
}
}
?>
尝试在管理目录中添加 includes 文件夹并将编码更改为
include_once('includes/config.php');