Commit edd0d6b2 authored by Dominik Hebeler's avatar Dominik Hebeler

IP-Adresse wird nun temporär gespeichert, damit wir Bots sperren und den...

IP-Adresse wird nun temporär gespeichert, damit wir Bots sperren und den Server für echte Nutzer schnell behalten können
parent 1c1a9883
......@@ -871,6 +871,10 @@ class MetaGer
$this->q = strtolower($this->eingabe);
# IP
$this->ip = $request->ip();
# Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit
# nicht einmal wir selbst noch Zugriff auf die Daten haben:
$this->ip = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $this->ip);
# Language
if (isset($_SERVER['HTTP_LANGUAGE'])) {
$this->language = $_SERVER['HTTP_LANGUAGE'];
......@@ -1153,12 +1157,9 @@ class MetaGer
{
$logEntry = "";
$logEntry .= "[" . date(DATE_RFC822, mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
$logEntry .= " ip=" . $this->request->ip();
$logEntry .= " pid=" . getmypid();
$logEntry .= " ref=" . $this->request->header('Referer');
$useragent = $this->request->header('User-Agent');
$useragent = str_replace("(", " ", $useragent);
$useragent = str_replace(")", " ", $useragent);
$useragent = str_replace(" ", "", $useragent);
$logEntry .= " time=" . round((microtime(true) - $this->starttime), 2) . " serv=" . $this->fokus;
$logEntry .= " search=" . $this->eingabe;
......
......@@ -13,13 +13,6 @@ if (isset($_SERVER["HTTP_FORWARDED"]) && isset($_SERVER["HTTP_X_FORWARDED_FOR"])
unset($_SERVER["HTTP_FORWARDED"]);
}
# Unser erster Schritt wird sein, IP-Adresse und USER-Agent zu anonymisieren, damit
# nicht einmal wir selbst noch Zugriff auf die Daten haben:
if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']) && isset($_SERVER['REMOTE_ADDR'])) {
$_SERVER['REMOTE_ADDR'] = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $_SERVER['REMOTE_ADDR']);
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$_SERVER['HTTP_X_FORWARDED_FOR'] = preg_replace("/(\d+)\.(\d+)\.\d+.\d+/s", "$1.$2.0.0", $_SERVER['HTTP_X_FORWARDED_FOR']);
}
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$agentPieces = explode(" ", $_SERVER['HTTP_USER_AGENT']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment