我的代码在localhost中工作正常,但在服务器上传后我收到此错误 - >禁
您无权访问此服务器上的/admin/add.php。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。
搜索了它,但没有得到fb grps中的正确解决方案。还有一件事,根文件夹中没有.htaccess文件。试图在服务器中添加.htaccess文件但是并没有那么好用。我在textarea中使用summernote以前我使用过tinymce但是得到了相同的错误。没有summernote / tinymce,它的工作正常。 textarea类型是中等文本
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>';
}
}
?>
答案 0 :(得分:1)
尝试在admin目录中添加includes文件夹并将编码更改为
include_once('includes/config.php');