Welcome Guest, Not a member yet? Register   Sign In
Detecting a users first visit to a website using codeigniters session library
#5

[eluser]Clooner[/eluser]
I use something like this.
Code:
function isNew()
{
    $CI = & get_instance();
    $this->_key = $CI->session->userdata('visitor_key');
    if (!$this->_key)
    {
        $this->_key = uniqid();
        $CI->session->set_userdata('visitor_key', $this->_key);
        return true;
    }
    return false;
}
You will need to load the session library and make sure your settings are correct. I have this in a library but you could put it also in a (MY_)Controller with minor adjustments!


Messages In This Thread
Detecting a users first visit to a website using codeigniters session library - by El Forum - 08-11-2010, 01:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB