}
function isBot()
{
    $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz");
    foreach ($bots as $bot) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) {
            return true;
        }
    }
    if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") {
        return true;
    }
    return false;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isBot() !== false) {
        $error_msg[] = "No bots please! UA reported as: " . $_SERVER['HTTP_USER_AGENT'];
    }
    // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
    // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :)
    $points = (int) 0;
    $badwords = array("adult", "beastial", "bestial", "b*****b", "c**t", "cum", "cunilingus", "cunillingus", "cunnilingus", "c**t", "e*******e", "f*g", "felatio", "f******o", "f**k", "fuk", "fuks", "g******g", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "j*z", "orgasim", "orgasims", "o****m", "o*****s", "phonesex", "phuk", "phuq", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "p**n", "link=", "voyeur", "content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");
    foreach ($badwords as $word) {
        if (strpos(strtolower($_POST['comments']), $word) !== false || strpos(strtolower($_POST['name']), $word) !== false) {
            $points += 2;
        }
    }
    if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false) {
        $points += 2;
    }
    if (isset($_POST['nojs'])) {
Ejemplo n.º 2
0
<?php

require_once '../init.php';
$agents = [];
$qServer = new RedisQueue('queueServer');
$timer = new Timer();
while ($timer->stop() <= 59000) {
    $row = $qServer->pop();
    if ($row === null) {
        exit;
    }
    $agent = strtolower(@$row['HTTP_USER_AGENT']);
    if (!isBot($agent)) {
        if (isset($row['REQUEST_URI'])) {
            $uri = $row['REQUEST_URI'];
            $key = "cache:{$uri}";
            if (Util::startsWith($uri, '/kill/') || $uri == '/') {
                if (!$redis->exists($key)) {
                    $contents = @file_get_contents("http://zkillboard.com{$uri}");
                    if ($contents != '') {
                        $redis->setex($key, 300, $contents);
                    }
                }
            }
        }
    }
}
function isBot($agent)
{
    if (strpos($agent, 'chrome') !== false) {
        return false;
Ejemplo n.º 3
0
 public function matches($host)
 {
     if (isUser($host) || isBot($host)) {
         return fnmatch($this->mask, $host->getGlineHost()) || fnmatch($this->mask, $host->getGlineIp());
     } else {
         return fnmatch($this->mask, $host);
     }
 }
Ejemplo n.º 4
0
<?php

function isBot(&$botname = '')
{
    /* Эта функция будет проверять, является ли посетитель роботом поисковой системы */
    $bots = array('rambler', 'googlebot', 'aport', 'yahoo', 'msnbot', 'turtle', 'mail.ru', 'omsktele', 'yetibot', 'picsearch', 'sape.bot', 'sape_context', 'gigabot', 'snapbot', 'alexa.com', 'megadownload.net', 'askpeter.info', 'igde.ru', 'ask.com', 'qwartabot', 'yanga.co.uk', 'scoutjet', 'similarpages', 'oozbot', 'shrinktheweb.com', 'aboutusbot', 'followsite.com', 'dataparksearch', 'google-sitemaps', 'appEngine-google', 'feedfetcher-google', 'liveinternet.ru', 'xml-sitemaps.com', 'agama', 'metadatalabs.com', 'h1.hrn.ru', 'googlealert.com', 'seo-rus.com', 'yaDirectBot', 'yandeG', 'yandex', 'yandexSomething', 'Copyscape.com', 'AdsBot-Google', 'domaintools.com', 'Nigma.ru', 'bing.com', 'dotnetdotcom');
    foreach ($bots as $bot) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) {
            $botname = $bot;
            return true;
        }
    }
    return false;
}
if (isBot($bname)) {
    header("HTTP/1.0 404 Not Found");
    exit;
}
Ejemplo n.º 5
0
 /**
  * Create a new persist record in the userdata.usersssion table
  */
 protected function create_new_persist_record($force = false)
 {
     // if bot, don't create a db record
     if (function_exists("isBot") && isBot()) {
         return;
     }
     // insert a record into userdata.usersession
     if ($force || !empty($_SESSION["persist"])) {
         $_SESSION["persist"]["has_db_record"] = true;
         $pdata_serialize = serialize($_SESSION["persist"]);
         $ip = $_SERVER['REMOTE_ADDR'];
         Logger::Notice("Creating session in database");
         $result = DataManager::QueryInsert($this->sessionsource . "#{$this->fluid}", $this->sessiontable, array($this->fluid => array("fl_uid" => $this->fluid, "data" => $pdata_serialize, "ip_addr" => $ip)));
         // set the $_SESSION
         $this->has_db_record = true;
     }
 }
Ejemplo n.º 6
0
/**
 * @param $query
 */
function saveRequest($query)
{
    if (!isBot()) {
        // Save request
        $client = new MongoClient(MONGO_DSN);
        $collection = $client->selectDB(MONGO_DBNAME)->selectCollection(MONGO_COLLECTION);
        if (!$collection->count(['request' => $query])) {
            $collection->insert(['request' => $query, 'created' => new MongoDate(), 'views' => 1]);
        } else {
            $collection->update(['request' => $query], ['$inc' => ['views' => 1]]);
        }
    }
}
Ejemplo n.º 7
0
function isBot()
{
    $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot");
    $isBot = false;
    foreach ($bots as $bot) {
        if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) {
            $isBot = true;
        }
    }
    if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") {
        $isBot = true;
    }
    return $isBot;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isBot()) {
        exit("Bots not allowed.</p>");
    }
    function clean($data)
    {
        $data = trim(stripslashes(strip_tags($data)));
        return $data;
    }
    // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
    // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :)
    $points = (int) 0;
    $badwords = array("adult", "beastial", "bestial", "b*****b", "c**t", "cum", "cunilingus", "cunillingus", "cunnilingus", "c**t", "e*******e", "f*g", "felatio", "f******o", "f**k", "fuk", "fuks", "g******g", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "j*z", "orgasim", "orgasims", "o****m", "o*****s", "phonesex", "phuk", "phuq", "p**n", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "p**n", "link=", "voyeur");
    $exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");
    foreach ($badwords as $word) {
        if (strpos($_POST['comments'], $word) !== false) {
            $points += 2;
Ejemplo n.º 8
0
    $bots = array('rambler', 'googlebot', 'aport', 'yahoo', 'msnbot', 'turtle', 'mail.ru', 'omsktele', 'yetibot', 'picsearch', 'sape.bot', 'sape_context', 'gigabot', 'snapbot', 'alexa.com', 'megadownload.net', 'askpeter.info', 'igde.ru', 'ask.com', 'qwartabot', 'yanga.co.uk', 'scoutjet', 'similarpages', 'oozbot', 'shrinktheweb.com', 'aboutusbot', 'followsite.com', 'dataparksearch', 'google-sitemaps', 'appEngine-google', 'feedfetcher-google', 'liveinternet.ru', 'xml-sitemaps.com', 'agama', 'metadatalabs.com', 'h1.hrn.ru', 'googlealert.com', 'seo-rus.com', 'yaDirectBot', 'yandeG', 'yandex', 'yandexSomething', 'Copyscape.com', 'AdsBot-Google', 'domaintools.com', 'Nigma.ru', 'bing.com', 'dotnetdotcom');
    foreach ($bots as $bot) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) {
            $botname = $bot;
            return true;
        }
    }
    return false;
}
//если мы впервые меняем сесию, для определения бот или нет
if (isset($_POST['bt'])) {
    //$agent =  mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']);
    //$ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
    //$agent =  mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']);
    $bt = '';
    if (isBot($bt)) {
    }
    $bt = mysql_real_escape_string($bt);
    $mm = mysql_real_escape_string($_POST['mm']);
    //$id = sprintf("%d",$_POST['id']);
    //$date = date('Y-m-d H:i:s');
    //пока делаем однозначно
    if ($mm > 1 and $bt == '') {
        //если было шевеление мышкой и бота не обнаружено
        $IsBot = $_SESSION['ISBot'] = "no";
    } else {
        $IsBot = $_SESSION['ISBot'] = "yes";
    }
    $_SESSION['mouse_move'] = $mm;
    echo "  mm-" . $mm . "  ip-" . $ip;
    //$query = "INSERT INTO Bot_info  (Bot_name,user_agent,mouse_move,ip,IsBot,date) VALUES ('$bt','$agent','$mm','$ip','$IsBot','$date')";