Changeset 1552 in ExiteCMS for trunk/includes/user_functions.php


Ignore:
Timestamp:
07/28/08 11:06:51 (4 years ago)
Author:
root
Message:

Try to detect bots and crawlers, only update the visitors counter if we think it's a regular user

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/user_functions.php

    r1548 r1552  
    2525} 
    2626 
     27// check for bot users 
     28$_bot_list = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi","looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory","Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot","crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp","msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz","Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot","Mediapartners-Google", "Sogou web spider", "WebAlta Crawler"); 
     29foreach($_bot_list as $bot) { 
     30    if(ereg($bot, $_SERVER['HTTP_USER_AGENT'])) { 
     31        define("CMS_IS_BOT", true); 
     32        break; 
     33    } 
     34} 
     35if (!defined("CMS_IS_BOT")) { 
     36    define("CMS_IS_BOT", false); 
     37} 
     38unset($_bot_list); 
     39 
    2740// Set the users site_visited cookie if this is the first visit, and update the unique visit counter 
    2841// save the random site_visited value, we need that later in session management! 
    29 if (!isset($_COOKIE['site_visited'])) { 
     42if (!CMS_IS_BOT && !isset($_COOKIE['site_visited'])) { 
    3043    $result=dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = cfg_value+1 WHERE cfg_name = 'counter'"); 
    3144    $site_visited = md5(uniqid(rand(), true)); 
Note: See TracChangeset for help on using the changeset viewer.