Esempio n. 1
0
} elseif (!(strpos($_SERVER['PHP_SELF'], 'misc.php') !== false && $_REQUEST['action'] == 'counter') && $_SERVER['REQUEST_URI']) {
    require_once BASEDIR . getmodulepath('stats') . 'functions.php';
    $weekstamp = stats_weekstamp($statsnow);
    //User-Info
    $browser = stats_browser($_SERVER['HTTP_USER_AGENT']);
    if ($browser != 'SEARCHENGINE' || $set['stats']['countsearchengine']) {
        if (!isset($stats_exists)) {
            list($stats_exists) = $db->first("SELECT daystamp FROM " . PRE . "_stats WHERE daystamp='" . $daystamp . "' LIMIT 1");
        }
        if ($stats_exists) {
            $db->query("UPDATE " . PRE . "_stats SET hits=hits+1 WHERE daystamp='" . $daystamp . "' LIMIT 1");
        } else {
            $db->quieterror = true;
            $db->query("INSERT INTO " . PRE . "_stats (daystamp,weekstamp,weekday,time,hits) VALUES ('" . $daystamp . "','" . $weekstamp . "','" . $weekday . "','" . time() . "',1)");
            $db->quieterror = false;
        }
    }
}
///////////////////////////// Referer /////////////////////////////
if ($_REQUEST['action'] != 'counter' && $_SERVER['HTTP_REFERER'] && strtolower(substr($_SERVER['HTTP_REFERER'], 0, 7)) == 'http://' && ($set['stats']['ownreferer'] || strpos(strtolower($_SERVER['HTTP_REFERER']), 'http://' . strtolower($_SERVER['HTTP_HOST'])) === false)) {
    require_once BASEDIR . getmodulepath('stats') . 'functions.php';
    //Host + Searchstring
    $host = stats_host($_SERVER['HTTP_REFERER']);
    $searchstring = stats_searchstring($_SERVER['HTTP_REFERER']);
    list($referer_exists) = $db->first("SELECT daystamp FROM " . PRE . "_stats_referer WHERE ( daystamp='" . $daystamp . "' AND hash='" . addslashes(md5($_SERVER['HTTP_REFERER'])) . "' AND url='" . addslashes($_SERVER['HTTP_REFERER']) . "' ) LIMIT 1");
    if ($referer_exists) {
        $db->query("UPDATE " . PRE . "_stats_referer SET hits=hits+1 WHERE ( daystamp='" . $daystamp . "' AND hash='" . addslashes(md5($_SERVER['HTTP_REFERER'])) . "' AND url='" . addslashes($_SERVER['HTTP_REFERER']) . "' ) LIMIT 1");
    } else {
        $db->query("INSERT INTO " . PRE . "_stats_referer VALUES ('" . $daystamp . "','" . $statsnow . "','" . addslashes($host) . "','" . addslashes($_SERVER['HTTP_REFERER']) . "','" . addslashes(md5($_SERVER['HTTP_REFERER'])) . "','" . $searchstring . "',1)");
    }
}
Esempio n. 2
0
function stats_searchstring($url)
{
    $url = urldecode($url);
    $host = strtolower(stats_host($url));
    if (preg_match('#^(www\\.)?google\\.[a-z]{2,4}$#', $host)) {
        $searchstring = stats_param_value($url, 'q');
    }
    //Google
    if (preg_match('#^([a-z]+\\.)?search.yahoo\\.com$#', $host)) {
        $searchstring = stats_param_value($url, 'p');
    }
    //Yahoo
    if (preg_match('#^search.msn\\.[a-z]{2,4}$#', $host)) {
        $searchstring = stats_param_value($url, 'q');
    }
    //MSN
    if (preg_match('#^([a-z]+\\.)?altavista\\.com$#', $host)) {
        $searchstring = stats_param_value($url, 'q');
    }
    //Altavista
    if ($host == 'brisbane.t-online.de') {
        $searchstring = stats_param_value($url, 'q');
    }
    //T-Online
    if ($host == 'suche.lycos.com') {
        $searchstring = stats_param_value($url, 'query');
    }
    //Lycos
    if ($host == 'suche.fireball.de') {
        $searchstring = stats_param_value($url, 'query');
    }
    //Fireball
    if ($host == 'search.aol.com') {
        $searchstring = stats_param_value($url, 'query');
    }
    //AOL
    if ($host == 'suche.aol.de') {
        $searchstring = stats_param_value($url, 'q');
    }
    //AOL Deutsch
    if ($host == 'search.live.com') {
        $searchstring = stats_param_value($url, 'q');
    }
    //Live.com
    return trim($searchstring);
}