Welcome Guest, Not a member yet? Register   Sign In
Session problem (duplicate records)
#1

[eluser]adwin[/eluser]
I am still using CI 1.6.2 with FreakAuth 1.1

I got a problem with Session (ci_sessions) because when I tried to load on view
like this
Code:
if($this->freakauth_light->isValidUser())
{
   $obj =& get_instance();    
   $obj->load->library('session');
   echo $obj->session->userdata('ip_address');
}

I notice that my ci_sessions added 1 records. and soon after I refresh this page, I found that my ci_sessions added 1 more records. it also makes me logged out and force me to login again.

my controller was like this
Code:
<?php
    class Test extends Controller{

        function Test(){
            parent::Controller();
            $this->freakauth_light->check();
            $this->_container = $this->config->item('FAL_template_dir').'template/container';    
        }

        function index(){
            $data['heading'] = 'Menu';
            $this->mysmarty->assign('name', 'tester');
            $data['mysmartypage'] = "simply for testing <b> test </b> ";
            $data['message'] = 'this page is for testing purposes only ' ;
            
            $this->load->vars($data);        
            $this->load->view($this->_container);        
        }
    }
?&gt;

am i make any mistakes in here ?
#2

[eluser]stanDman[/eluser]
Hey there,

I had the very same problem, at least judging by the symptoms you described. Here is what helped me - in your code:

$obj->load->library('session');
echo $obj->session->userdata('ip_address');

try not loading the session class, FAL has it's own session class called Db_session, which you don't even have to load in your script, it loads it for you Wink. Just use $obj->db_session instead of $obj->session, after removing the first line, that's all. The thing is that FAL creates cookie for the session and sets it up, and everything is fine, but when you load the Session class it sets it up again( and with the same name, taken from config.php) and ultimately changes the cookie too therefore messing up with Db_session class' functionality and vice versa so they keep creating/changing/setting cookies and as a result can't 'recognize' you as the user that just logged in Smile. I am pretty sure that is the case with your problem. I hope my reply comes in time. Best of luck, and let me know if this helped you.

S.




Theme © iAndrew 2016 - Forum software by © MyBB