piernas Posted April 12, 2017 Share Posted April 12, 2017 I've wondered why who's online addon did not identify bots other than googlebot and showed as normal users. I have updated spiders.txt for each bot I find, but none of them showed as bots on this addon. Today, while adapting this addon to recent osc versions, I finally found the problem: If you have SESSION_FORCE_COOKIE_USE set to true oscommerce skips completely the check for spiders and $spider_flag variable is not set at all.So, if you experience this problem with your configuraton, all you have to do is do the check on the includesfunctions/whos_online.php file: Right below: function tep_update_whos_online() { global $customer_id, $spider_flag, $user_agent; add: is_spider (); and in the end of the file add the function itself: function is_spider () { global $user_agent, $spider_flag; $spider_flag = false; if (tep_not_null($user_agent)) { $spiders = file('includes/spiders.txt'); $n=sizeof($spiders); for ($i=0; $i<$n; $i++) { if (tep_not_null($spiders[$i])) { if (is_integer(strpos($user_agent, trim($spiders[$i])))) { $spider_flag = true; break; } } } } } Now the bots will show as boots :) assuming the correct strings are on spiders.txt Quote Link to comment Share on other sites More sharing options...
burt Posted April 13, 2017 Share Posted April 13, 2017 I'm sure there was a reason why the Bots were removed from the whos_online in the Core. But I cannot remember what that reason was... Will try to find it and post back. piernas 1 Quote Link to comment Share on other sites More sharing options...
piernas Posted April 14, 2017 Author Share Posted April 14, 2017 I imagine there was no need to keep the spider flag once the cookie has been forced. It's interesting for who is online addon but the stock module is very limited. Quote Link to comment Share on other sites More sharing options...
♥John W Posted April 14, 2017 Share Posted April 14, 2017 At one time, I remember there was a security issue with who's online, which caused some changes to be made. I don't remember exactly when or what though. Quote I'm not really a dog. Link to comment Share on other sites More sharing options...
♥John W Posted April 14, 2017 Share Posted April 14, 2017 Actually, after trying your code, it still didn't identify Googlebot. Ip 66.249.64.191 is one of those for Googlebot. Quote I'm not really a dog. Link to comment Share on other sites More sharing options...
piernas Posted April 14, 2017 Author Share Posted April 14, 2017 @@John W the code is for the who's online enhancement http://addons.oscommerce.com/info/824 ; the stock module does not have any code for bots. Quote Link to comment Share on other sites More sharing options...
♥John W Posted April 14, 2017 Share Posted April 14, 2017 Okay, thanks! Quote I'm not really a dog. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.