0
我的代碼工作在本地主機正常,但在服務器上載後,我得到這個錯誤 - >故宮您沒有權限訪問此服務器上/admin/add.php
您沒有權限訪問此服務器上的/admin/add.php。 此外,嘗試使用ErrorDocument處理請求時遇到404 Not Found錯誤。
搜索了一下,但沒有得到一個適當的解決方案問在fb grps as-well。還有一件事是根文件夾中沒有.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>';
}
}
?>
你檢查你的文件和文件夾的文件/文件夾的權限在服務器? –
問主機... – nogad
'此外,嘗試使用ErrorDocument來處理請求時遇到了404 Not Found錯誤。「只是表示您沒有用於設置403的錯誤文檔,可以忽略。檢查Web服務器錯誤日誌,但最有可能的權限錯誤。 – Devon