表单上的Codeignitor提交用户会话数据丢失

时间:2018-12-20 08:01:52

标签: forms codeigniter session

我正在开发codeignitor列表应用程序,在应用程序中一切正常,但是当我提交列表时,用户会话数据正在丢失。

就像我在会话中具有agentId一样,该名称在登录后可见,但是在提交后不在会话数据中。

代码:

$agentId = $this->session->userdata('agentId');

       var_dump($this->session->userdata);
    die;
\\ This session showing all user data including agentId


    $data['p_title'] = $this->project_model->projectName().' :: Property : Add New Property';
    $data['Message'] = '';  
    $data['heading'] = 'Property: Add New Property';
    $data['pageName'] = 'property';

    $data['title'] = filter_value('title', '');
    $data['meta_decription'] = filter_value('meta_decription', '');
    $data['keywords'] = filter_value('keywords', '');
    $data['type'] = filter_value('type', '');
    $data['sub_type'] = filter_value('sub_type', '');
    //$data['sub_type1'] = filter_value('sub_type1', '');
    $data['bedrooms'] = filter_value('bedrooms', '');
    $data['kitchen'] = filter_value('kitchen', '');
    $data['parking'] = filter_value('parking', 'YES');
    $data['bathrooms'] = filter_value('bathrooms', '');
    $data['area'] = filter_value('area', '');
    $data['price'] = filter_value('price', '0.00');
    $data['location'] = filter_value('location', '');
    $data['city'] = filter_value('city', 82);
    $data['country'] = filter_value('country', 102);
    $data['details'] = filter_value('details', '');
    $data['featured'] = filter_value('featured', 'NO');

    $data['countries'] = $this->general_model->listCountries($data['country']);
    $data['cities'] = $this->general_model->listCities($data['country'], $data['city']);

    $this->form_validation->set_rules('title', 'Property title', 'trim|required');
    if($this->form_validation->run() === TRUE){
        $agentId = $this->session->userdata('agentId');
         var_dump($this->session->userdata);
        die;
\\ but here the agent id and rest of user session data is removed.
        $Date = getCurrentDate();
        $Time = getCurrentTime();
        $DbFieldsAry = array('agentId', 'title', 'meta_decription', 'keywords', 'type', 'sub_type', 'bedrooms', 'kitchen', 'parking', 'bathrooms', 'area', 'price', 'location', 'city', 'country', 'details', 'featured', 'date');
        $InfoAry = array($this->session->userdata('agentId'), $data['title'], $data['meta_decription'], $data['keywords'], $data['type'], $data['sub_type'], $data['bedrooms'], $data['kitchen'], $data['parking'], $data['bathrooms'], $data['area'], $data['price'], $data['location'], $data['city'], $data['country'], $data['details'], $data['featured'], $Date);             

        if($this->general_model->addInfo_Simple($DbFieldsAry, $InfoAry, 'tbl_properties_list')){                    
            $activityId = $this->general_model->getSingleValue($data['title'], 'title', 'property_id', 'tbl_properties_list');
            setMessage('success_message', 'New property added successfully. Add pictures to property.');
            redirect(base_url().'property/update/'.$activityId.'/0', 'refresh');
        }
        else{
            setMessage('error_message', 'Unable to perofrm this operation, please try again later!');
            redirect(base_url().'property/user_listing', 'refresh');    
        }

    }

    $data['allowed'] = true;
    $data['warning'] = '';

    if(!isSuperAdmin()){
        $total_properties = $this->general_model->getTotalDataSimple1('property_id','tbl_properties_list');
        if(allowed_properties() <= $total_properties){
            $data['allowed'] = false;
            $data['warning'] = '<br/>You have reached to maximum limit of your property upload listing.<br/>Click <a href="'.base_url().'payment">HERE</a> to change payment plan.<br/><br/><br/><br/><br/>';
        }
    }
    $this->load->view('add_property', $data);

用于会话检查的第一个var_dump显示所有会话数据,但是在提交所有用户会话数据后,这些数据丢失了。

任何人都可以让我知道此代码中的错误在哪里吗。

谢谢

0 个答案:

没有答案
相关问题