Also google hat mich laut Benutzersession seit gestern nimmer besucht (dank dem Code).
Yahoo steht jedoch noch drin.
diesen code
Code: Select all
function Tracking($action, $id = 0)
{
global $db, $PMF_CONF, $sid, $user;
if (isset($PMF_CONF["main.enableUserTracking"])) {
if (isset($_GET["sid"])) {
$sid = $_GET["sid"];
}
if (isset($_COOKIE['pmf_sid'])) {
$sid = $_COOKIE['pmf_sid'];
}
if ($action == "old_session") {
$sid = null;
}
if (!isset($sid)) {
$sid = $db->nextID(SQLPREFIX."faqsessions", "sid");
// HACK: be sure that pmf_sid cookie contains the current $sid
if (isset($_COOKIE["pmf_sid"]) && ((int)$_COOKIE['pmf_sid'] != $sid)) {
setcookie('pmf_sid', $sid, time() + 3600);
}
$db->query("
INSERT INTO
".SQLPREFIX."faqsessions
(sid, user_id, ip, time)
VALUES
(".$sid.", ".($user ? $user->getUserId() : '-1').", '".$_SERVER["REMOTE_ADDR"]."', ".time().")"
);
}
$fp = @fopen("./data/tracking".date("dmY"), "a+b");
if (function_exists("stream_encoding")) {
stream_encoding($fp, "iso-8859-1");
}
if ($fp) {
$flanz = "0";
while (!flock($fp, LOCK_EX) && $flanz < 6) {
wait(500);
$flanz++;
}
if ($flanz >= 6) {
fclose($fp);
} elseif ((!empty($_SERVER["HTTP_REFERER"])) || ($action == "new_session")) {
if (!isset($_SERVER["HTTP_REFERER"])) {
$_SERVER["HTTP_REFERER"] = "";
}
if (!isset($_SERVER["QUERY_STRING"])) {
$_SERVER["QUERY_STRING"] = "";
}
fputs($fp, $sid.";".str_replace(";", ",",$action).";".$id.";".$_SERVER["REMOTE_ADDR"].";".str_replace(";", ",", $_SERVER["QUERY_STRING"]).";".str_replace(";", ",", $_SERVER["HTTP_REFERER"]).";".str_replace(";", ",", urldecode($_SERVER["HTTP_USER_AGENT"])).";".time().";\n");
flock($fp, LOCK_UN);
fclose($fp);
}
}
}
}
durch diesen
ersetzen
Code: Select all
function Tracking($action, $id = 0)
{
global $db, $PMF_CONF, $sid, $user;
if (isset($PMF_CONF["main.enableUserTracking"])) {
if (isset($_GET["sid"])) {
$sid = $_GET["sid"];
}
if (isset($_COOKIE['pmf_sid'])) {
$sid = $_COOKIE['pmf_sid'];
}
if ($action == "old_session") {
$sid = null;
}
$bots=0;
$agent=$_SERVER['HTTP_USER_AGENT'];
$blacklist = array('nustcrape','webpost','google','crawler','scooter','bravobrian','archiver','w3c','control','wget','bot','spider','Yahoo! Slurp');
foreach($blacklist as $checkit) {
if(preg_match ("=$checkit=i", $agent)) { $bots++; } }
if(empty($agent)) { $bots++; }
if(empty($bots)) {
if (!isset($sid)) {
$sid = $db->nextID(SQLPREFIX."faqsessions", "sid");
// HACK: be sure that pmf_sid cookie contains the current $sid
if (isset($_COOKIE["pmf_sid"]) && ((int)$_COOKIE['pmf_sid'] != $sid)) {
setcookie('pmf_sid', $sid, time() + 3600);
}
$db->query("
INSERT INTO
".SQLPREFIX."faqsessions
(sid, user_id, ip, time)
VALUES
(".$sid.", ".($user ? $user->getUserId() : '-1').", '".$_SERVER["REMOTE_ADDR"]."', ".time().")"
);
}
$fp = @fopen("./data/tracking".date("dmY"), "a+b");
if (function_exists("stream_encoding")) {
stream_encoding($fp, "iso-8859-1");
}
if ($fp) {
$flanz = "0";
while (!flock($fp, LOCK_EX) && $flanz < 6) {
wait(500);
$flanz++;
}
if ($flanz >= 6) {
fclose($fp);
} elseif ((!empty($_SERVER["HTTP_REFERER"])) || ($action == "new_session")) {
if (!isset($_SERVER["HTTP_REFERER"])) {
$_SERVER["HTTP_REFERER"] = "";
}
if (!isset($_SERVER["QUERY_STRING"])) {
$_SERVER["QUERY_STRING"] = "";
}
fputs($fp, $sid.";".str_replace(";", ",",$action).";".$id.";".$_SERVER["REMOTE_ADDR"].";".str_replace(";", ",", $_SERVER["QUERY_STRING"]).";".str_replace(";", ",", $_SERVER["HTTP_REFERER"]).";".str_replace(";", ",", urldecode($_SERVER["HTTP_USER_AGENT"])).";".time().";\n");
flock($fp, LOCK_UN);
fclose($fp);
}
}
}
}
}