Welcome Guest, Not a member yet? Register   Sign In
strange session issue value not getting set
#1

[eluser]mic[/eluser]
Hi,

I am having a strange issue with the session library. I have a values that get set when the admins try access the user pages, the admin_selected_user and the admin_demo_user. The admin_selected_user is an ID of the user and admin_demo_user is whether or not its a demo user, it get set to true or false.

It works fine if i go through user_loader first, but once i have gone through the demo_loader i cannot change or unset the admin_demo_user without destroying all the sessions first. all i want to do is be able to change the value of admin_demo_user between true or false.

Any help with this will be greatly received...

Thanks

these are my methods that are causing the issues
Code:
public function demo_loader()
    {
        
        //check and redirect the user before any other processing is done
        if(!$this->_auth()){ ci_redirect("cmc/login"); }
        //$this->_check_user_group(array("A", "T", "S"));

        //connect to the alternate DB
        $alt_db = $this->load->database('demo', TRUE);
        
        //lots of code to setup the fresh demo user......
        
        $this->session->unset_userdata("admin_demo_user");
        
        $this->session->set_userdata(array(    "admin_selected_user"     => $user_id));
        $this->session->set_userdata(array(    "admin_demo_user"         => true));
        
        ci_redirect("admin/user_home");

    }
    
    /**
     * user_loader
     *
     * this method loads the user account that has been selected
     *
     * @access    public
     */

    public function user_loader()
    {
        
        //check and redirect the user before any other processing is done
        if(!$this->_auth()){ ci_redirect("cmc/login"); }
        //$this->_check_user_group(array("A", "T", "S"));
        
        //check to make sure the post data is set, if so create the session variable
        if($this->input->post("user_id")):
            
            $this->session->unset_userdata("admin_demo_user");
            
            $this->session->set_userdata(array("admin_selected_user"    => $this->input->post("user_id")));
            $this->session->set_userdata(array("admin_demo_user"         => false));
            
            ci_redirect("admin/user_home");
        
        //else user_id not set return to the admin home page
        else:
        
            ci_redirect("admin/home");
        
        endif;        
        
    }




Theme © iAndrew 2016 - Forum software by © MyBB