Welcome Guest, Not a member yet? Register   Sign In
Storing a request URL
#6

[eluser]WanWizard[/eluser]
Ah, you're right.

I use a modified Session library that only writes the session once, at the end. I sometimes get confused between my code and standard CI, sorry.

You could do
Code:
class MY_Session extend Session
{
    function MY_Session()
    {
        parent::Session();
    }

    function sess_read()
    {
        $result = parent::sess_read();

        if ( $result )
        {
            if ( isset($this->userdata['current_url']) )
            {
                // the previous current_url is now the referer url
                $this->userdata['referer'] = $this->userdata['current_url'];
            }
            // store the current_url
            $this->userdata['current_url'] = current_url();   // assumes you have the url helper loaded
        }
        return $result;
    }
}
This only means that the first page request after a new session record has been created, you don't have a referer. For all subsequent requests, the previous url is now the referer.


Messages In This Thread
Storing a request URL - by El Forum - 07-24-2010, 10:36 AM
Storing a request URL - by El Forum - 07-24-2010, 11:11 AM
Storing a request URL - by El Forum - 07-24-2010, 11:20 AM
Storing a request URL - by El Forum - 07-24-2010, 11:24 AM
Storing a request URL - by El Forum - 07-24-2010, 12:21 PM
Storing a request URL - by El Forum - 07-24-2010, 12:28 PM
Storing a request URL - by El Forum - 07-24-2010, 12:34 PM
Storing a request URL - by El Forum - 07-24-2010, 03:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB