Commit 63cd7ca5 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

each spam entry gets its own verification id

parent fd9fa01b
......@@ -233,13 +233,13 @@ class HumanVerification extends Controller
# Check for recent Spams
$eingabe = \Request::input('eingabe');
$spams = Redis::lrange("spam", 0, -1);
foreach ($spams as $spam) {
foreach ($spams as $index => $spam) {
if (\preg_match($spam, $eingabe)) {
return true;
return "999.999.999.999" . $index;
}
}
return false;
return null;
}
public function botOverview(Request $request)
......
......@@ -31,9 +31,11 @@ class HumanVerification
$ip = $request->ip();
$id = "";
$uid = "";
if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) {
$id = hash("sha1", "999.999.999.999");
$uid = hash("sha1", "999.999.999.999uid");
$spamID = \App\Http\Controllers\HumanVerification::couldBeSpammer($ip);
if (!empty($spamID)) {
$id = hash("sha1", $spamID);
$uid = hash("sha1", $spamID . "uid");
} else {
$id = hash("sha1", $ip);
$uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid");
......@@ -96,7 +98,6 @@ class HumanVerification
if (preg_match("/http[s]{0,1}:\/\/metager\.de\/meta\/meta.ger3\?.*?eingabe=([\w\d]+\.){1,2}[\w\d]+/si", $referer) === 1) {
$refererLock = true;
}
}
if ((!$alone && $sum >= 50 && !$user["whitelist"]) || $refererLock) {
......@@ -143,7 +144,6 @@ class HumanVerification
$request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]);
return $next($request);
}
public function setUser($prefix, $user)
......
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