summaryrefslogtreecommitdiffstats
path: root/system/libraries/User_agent.php
diff options
context:
space:
mode:
authorvlakoff <vlakoff@gmail.com>2013-07-20 20:27:35 +0200
committervlakoff <vlakoff@gmail.com>2013-07-20 20:27:35 +0200
commit161f1935d72dadb12da1a314a91f5da75826b391 (patch)
tree7d8ab000f22aa31ef18dbd17c31d99575a524bc3 /system/libraries/User_agent.php
parent3d3e250e40e2f844424a7984488f6dd89495fa5f (diff)
User_agent library: robuster detection in is_referral()
Diffstat (limited to 'system/libraries/User_agent.php')
-rw-r--r--system/libraries/User_agent.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 2f6f81909..e27004e9e 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -476,8 +476,10 @@ class CI_User_agent {
return FALSE;
}
- $referer = parse_url($_SERVER['HTTP_REFERER']);
- return ! (empty($referer['host']) && strpos(config_item('base_url'), $referer['host']) !== FALSE);
+ $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
+ $own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
+
+ return ($referer_host && $referer_host !== $own_host);
}
// --------------------------------------------------------------------