Welcome Guest, Not a member yet? Register   Sign In
User_Agent library is not working?
#1

[eluser]Sein Kraft[/eluser]
I've updated to CI 2.0 and $this->agent->is_referral() no longer works, allways return false.
#2

[eluser]Sein Kraft[/eluser]
Ok, i've tested it on a fresh installation and i can confirm that is_referral() not working at all.

Code:
function try1(){
    echo anchor('welcome/try2');
}

function try2(){
    $this->load->library('user_agent');
    $is_referal = $this->agent->is_referral();

    if($is_referal){
        echo $this->agent->referrer();
    }
}
#3

[eluser]Eric Barnes[/eluser]
In User_agent.php can you change the is_referral method to this and see if it works?
Code:
/**
     * Is this a referral from another site?
     *
     * @access    public
     * @return    bool
     */
    public function is_referral()
    {
        if ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '')
        {
            return FALSE;
        }
        return TRUE;
    }
#4

[eluser]Sein Kraft[/eluser]
Yush! That solves the problem...that is strange because it should work.

Anyway, i've created this https://bitbucket.org/ellislab/codeignit...ot-working before your post. Just in case.

Thank you.
#5

[eluser]Eric Barnes[/eluser]
Thanks all sorted now.




Theme © iAndrew 2016 - Forum software by © MyBB