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

added default useragent

parent ce7a6c1f
......@@ -34,10 +34,13 @@ class UserAgentMaster
} else if ($agent->isPhone()) {
$device = "mobile";
}
// Push an entry to a list in Redis
// App\Console\Commands\SaveUseragents.php is called regulary to save the list into a sqlite database
Redis::rpush('useragents', json_encode(["platform" => $agent->platform(), "browser" => $agent->browser(), "device" => $device, "useragent" => $_SERVER['HTTP_USER_AGENT']]));
Redis::expire('useragents', 301);
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
// Push an entry to a list in Redis
// App\Console\Commands\SaveUseragents.php is called regulary to save the list into a sqlite database
Redis::rpush('useragents', json_encode(["platform" => $agent->platform(), "browser" => $agent->browser(), "device" => $device, "useragent" => $_SERVER['HTTP_USER_AGENT']]));
Redis::expire('useragents', 301);
}
// Try to retrieve a random User-Agent of the same category from the sqlite database
$newAgent = \App\UserAgent::where("platform", $agent->platform())
......
......@@ -16,7 +16,10 @@ if (isset($_SERVER["HTTP_FORWARDED"]) && isset($_SERVER["HTTP_X_FORWARDED_FOR"])
unset($_SERVER["HTTP_FORWARDED"]);
}
$_SERVER["AGENT"] = $_SERVER["HTTP_USER_AGENT"];
$_SERVER["AGENT"] = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1";
if (!empty($_SERVER["HTTP_USER_AGENT"])) {
$_SERVER["AGENT"] = $_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