diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index d1ea163920e64347d0c0d029a999365162ba3dbb..a04d55376a0474d31bd678f480cc9f51890e2421 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -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++; diff --git a/database/migrations/2018_04_26_114745_create_humanverification_table.php b/database/migrations/2018_04_26_114745_create_humanverification_table.php index 877cbf33b6c66ef41428285e1833150133dd0157..95c94233c98e95c00a0a6381c478362e80bd9ff4 100644 --- a/database/migrations/2018_04_26_114745_create_humanverification_table.php +++ b/database/migrations/2018_04_26_114745_create_humanverification_table.php @@ -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'); }); } diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index b4cf3893f7f39cc61507442446fcc9b556060b30..c5d67e2c4d4b73b273c1062314cbe7c627acd709 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -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; }); }