Commit d39e4aaf authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Erster Schritt: User-Agent anonymisiert

parent fed7821a
...@@ -15,6 +15,7 @@ class MetaGerSearch extends Controller ...@@ -15,6 +15,7 @@ class MetaGerSearch extends Controller
{ {
public function search(Request $request, MetaGer $metager) public function search(Request $request, MetaGer $metager)
{ {
#die($request->header('User-Agent'));
$time = microtime(); $time = microtime();
# Mit gelieferte Formulardaten parsen und abspeichern: # Mit gelieferte Formulardaten parsen und abspeichern:
$metager->parseFormData($request); $metager->parseFormData($request);
......
...@@ -462,6 +462,8 @@ class MetaGer ...@@ -462,6 +462,8 @@ class MetaGer
} }
$this->agent = new Agent(); $this->agent = new Agent();
$this->mobile = $this->agent->isMobile(); $this->mobile = $this->agent->isMobile();
if($this->mobile)
die("test");
#Sprüche #Sprüche
$this->sprueche = $request->input('sprueche', 'off'); $this->sprueche = $request->input('sprueche', 'off');
if($this->sprueche === "off" ) if($this->sprueche === "off" )
......
...@@ -12,6 +12,20 @@ ...@@ -12,6 +12,20 @@
if( !isset($_SERVER['HTTP_X_FORWARDED_FOR'] )) if( !isset($_SERVER['HTTP_X_FORWARDED_FOR'] ))
{ {
$_SERVER['REMOTE_ADDR'] = substr($_SERVER['REMOTE_ADDR'], 0, strrpos($_SERVER['REMOTE_ADDR'], ".")) . ".0"; $_SERVER['REMOTE_ADDR'] = substr($_SERVER['REMOTE_ADDR'], 0, strrpos($_SERVER['REMOTE_ADDR'], ".")) . ".0";
$_SERVER['HTTP_USER_AGENT'] = preg_replace("/\(.*\)/s", "( )", $_SERVER['HTTP_USER_AGENT']);
$agentPieces = explode(" ", $_SERVER['HTTP_USER_AGENT']);
for($i = 0; $i < count($agentPieces); $i++)
{
#$agentPieces[$i] = preg_quote($agentPieces[$i], "/");
$agentPieces[$i] = preg_replace("/([^\/]*)\/[^\/]*/s", "$1/0.0", $agentPieces[$i]);
#$agentPieces[$i] = "test";
}
$_SERVER['HTTP_USER_AGENT'] = implode(" ", $agentPieces);
#$_SERVER['HTTP_USER_AGENT'] = preg_replace("/(\b[^\/\s]*)[\B]*/s", "$1", $_SERVER['HTTP_USER_AGENT']);
#$_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 23); #$_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 23);
} }
......
Supports Markdown
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