Skip to content
Snippets Groups Projects
Commit 59d78abf authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '727-bot-schutz' into 'development'

Resolve "Bot Schutz"

Closes #727

See merge request !1212
parents 10563bef 8cab1f5b
No related branches found
No related tags found
2 merge requests!1262WIP: Resolve "Spendenseite Texte anpassen",!1212Resolve "Bot Schutz"
......@@ -38,7 +38,7 @@ class HumanVerification
DB::table('humanverification')->insert(
['id' => $id, 'unusedResultPages' => 1, 'locked' => false, 'updated_at' => now()]
);
$user = DB::table('humanverification')->where($id, $id)->first();
$user = DB::table('humanverification')->where('id', $id)->first();
}else if($user->locked !== "1"){
$unusedResultPages = intval($user->unusedResultPages);
$unusedResultPages++;
......
......@@ -14,10 +14,10 @@ class CreateHumanverificationTable extends Migration
public function up()
{
Schema::create('humanverification', function (Blueprint $table) {
$table->string('id');
$table->string('id')->unique();
$table->integer('unusedResultPages');
$table->boolean('locked');
$table->date('updated_at');
$table->timestamp('updated_at');
});
}
......
......@@ -134,7 +134,25 @@ function clickLog () {
function botProtection () {
$(".result").find("a").click(function(){
$.post('/img/cat.jpg', { mm: $("meta[name=mm]").attr("content")});
var link = $(this).attr("href");
var newtab = false;
if($(this).attr("target") == "_blank"){
newtab = true;
}
$.ajax({
url: '/img/cat.jpg',
type: "post",
data: { mm: $("meta[name=mm]").attr("content")},
timeout: 2000
})
.always(function(){
if(!newtab)
document.location.href = link;
});
if(!newtab)
return false;
else
return true;
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment