您没有权限访问此服务器上的/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文件,但没有正常工作。我在文本区使用summernote,以前我使用tinymce,但得到同样的错误。没有夏季笔记/时间安排也可以。文本区域类型为mediumtext

. 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>';
        }
    }
    ?>

尝试在admin目录中添加include文件夹并将编码更改为

include_once('includes/config.php');