dongzhao4036 2015-10-26 14:59
浏览 34

403 Hostserver中的禁止错误(Codeigniter)

Recently I've lunched an website REVIEW-BD. It was working fine till yesterday. Today one of my user told me that he is facing an error while submitting a post. The error is,

Forbidden

You don't have permission to access /index.php/site/post_new_blog on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I checked and faced the same issue. It is strange that I can post a little article without facing any problem but whenever I write larger article it gives me the error, but it was working fine yesterday. I googled and found some solution that I have to check the configuration of my apache. But as it is on the shared hosting so I dont have the access to the apache file and I think the config is ok. I really dont understand what to do. Any suggestion?

Method for the form VIEW

public function write_new_blog(){
                    $this->load->view('faviconshow');
        if($this->session->userdata('is_logged_in')){
            $this->load->view('newblog/newblog');
        }
        else echo "You are not authorized to see this page. Please login! "; 

        }

Method for POST

public function post_new_blog(){
                if($this->session->userdata('is_logged_in')){
        $this->load->library('form_validation');
        $this->form_validation->set_rules('blog_post','Post','required');
        $this->form_validation->set_rules('blog_title','Title','required|trim');
        $this->form_validation->set_rules('tag','Tag','required');
        $this->form_validation->set_rules('categories','Categories','required');
        if($this->form_validation->run()){

          $this->load->model('model_users');
         if($this->model_users->write_new_post())
            {

             redirect('site/profile/profile');
            }
        }
        else
            {
                $this->load->view('newblog/newblog');
            } 
                  } else echo "You are not authorized to see this page. Please login!";

Model

public function write_new_post(){
        $blogger_name= $this->session->userdata('name');
        $blogger_email= $this->session->userdata('email');
        /*$this->db->set('pic',$post_img_url);*/
        $data = array(
                'post_title' => $this->input->post('blog_title'),
                'tags' => $this->input->post('tag'),
                'post' => $this->input->post('blog_post'),
                'category' => $this->input->post('categories'),
                'email' => $blogger_email,
                'name' => $blogger_name,
                'pic' =>  $this->input->post('image_link')

        );

        $query = $this->db->insert('posts',$data); //ekhane posts table e oi table er value gula dhukbe.

        $copy_query = "SELECT post_id FROM posts order by post_id DESC limit 1"; //query for selecting last post's post_id
        $result = $this->db->query($copy_query);    //adding that post_id to the variable   
        if ($result->num_rows() > 0)
        {
                foreach ($result->result() as $row)
                {
                        $post_id_plz =  $row->post_id;
                }
        }

        //subcategorie table e er value gula nicher code er maddhome database e insert korbe :)
        $sub_data = array(
                'category' => $this->input->post('categories'),
                'study_education_level' => $this->input->post('sub_education_level'),
                'tourism_country' => $this->input->post('sub_tourism_country'),
                'tourism_place_name' => $this->input->post('sub_tourism_placeName'),
                'food_price' => $this->input->post('sub_food_price'),
                'food_restaurant' => $this->input->post('sub_food_restaurant'),
                'food_taste' => $this->input->post('sub_food_taste'),
                'food_item' => $this->input->post('sub_food_item'),
                'food_service' => $this->input->post('sub_food_service'),
                'food_environment' => $this->input->post('sub_food_environment'),
                'food_overall' => $this->input->post('sub_food_ovoerall'),
                'service_type' => $this->input->post('sub_service_type'),
                'service_company_name' => $this->input->post('sub_service_companyName'),
                'service_satisfaction_level' => $this->input->post('sub_service_satisfaction'),
                'music_album_name' => $this->input->post('sub_music_albumName'),
                'music_track_name' => $this->input->post('sub_music_trackName'),
                'music_artist' => $this->input->post('sub_music_artist'),
                'music_genre' => $this->input->post('sub_music_genre'),

                'book_name' => $this->input->post('sub_book_name'),
                'book_writer_name' => $this->input->post('sub_book_writer_name'),
                'book_rating' => $this->input->post('sub_book_rating'),
                'post_id' => $post_id_plz
        );

        $this->db->insert('subcategories',$sub_data);

        if($query)
        {
            return true;
        }
        else
        {
            return false;
        }

    }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计