diff --git a/app/Http/Controllers/HumanVerification.php b/app/Http/Controllers/HumanVerification.php
index e610f63dfa4ca7687fcff83f0bc804b23f3767db..30c0917f699bea93ec0175ac88554d201b1370f0 100644
--- a/app/Http/Controllers/HumanVerification.php
+++ b/app/Http/Controllers/HumanVerification.php
@@ -108,7 +108,13 @@ class HumanVerification extends Controller
     private static function removeUser($request, $uid)
     {
         $redis = Redis::connection('redisCache');
-        $id = hash("sha512", HumanVerification::getIP($request));
+        $ip = $request->ip();
+        $id = "";
+        if (HumanVerification::isTor($ip)) {
+            $id = hash("sha512", "999.999.999.999");
+        } else {
+            $id = hash("sha512", $ip);
+        }
 
         $userList = $redis->smembers(HumanVerification::PREFIX . "." . $id);
         $pipe = $redis->pipeline();
@@ -168,16 +174,23 @@ class HumanVerification extends Controller
 
     private static function checkId($request, $id)
     {
-        if (hash("sha512", HumanVerification::getIP($request) . $_SERVER["AGENT"] . "uid") === $id) {
+        $uid = "";
+        $ip = $request->ip();
+        if (HumanVerification::isTor($ip)) {
+            $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid");
+        } else {
+            $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid");
+        }
+
+        if ($uid === $id) {
             return true;
         } else {
             return false;
         }
     }
 
-    private static function getIP($request)
+    private static function isTor($ip)
     {
-        $ip = $request->ip();
         $serverAddress = empty($_SERVER['SERVER_ADDR']) ? "144.76.88.77" : $_SERVER['SERVER_ADDR'];
         $queryUrl = "https://tor.metager.org?password=" . urlencode(env("TOR_PASSWORD")) . "&ra=" . urlencode($ip) . "&sa=" . urlencode($serverAddress) . "&sp=443";
 
@@ -189,9 +202,9 @@ class HumanVerification extends Controller
         curl_close($ch);
 
         if ($httpcode === 200) {
-            return "999.999.999.999";
+            return true;
         } else {
-            return $ip;
+            return false;
         }
     }
 }
diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php
index 12d86ffc806fc84d309bbd764b2dcc218ee455d6..2f679a8c6d7dea33c66f6a87eaa7a56743bd9b04 100644
--- a/app/Http/Middleware/HumanVerification.php
+++ b/app/Http/Middleware/HumanVerification.php
@@ -26,9 +26,16 @@ class HumanVerification
         $prefix = "humanverification";
         $redis = Redis::connection('redisCache');
         try {
-            $ip = $this->getIP();
-            $id = hash("sha512", $ip);
-            $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid");
+            $ip = $request->ip();
+            $id = "";
+            $uid = "";
+            if ($this->isTor($ip)) {
+                $id = hash("sha512", "999.999.999.999");
+                $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid");
+            } else {
+                $id = hash("sha512", $ip);
+                $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid");
+            }
             unset($_SERVER["AGENT"]);
 
             /**
@@ -182,9 +189,8 @@ class HumanVerification
 
     }
 
-    private function getIP()
+    private function isTor($ip)
     {
-        $ip = \Request::ip();
         $serverAddress = empty($_SERVER['SERVER_ADDR']) ? "144.76.88.77" : $_SERVER['SERVER_ADDR'];
         $queryUrl = "https://tor.metager.org?password=" . urlencode(env("TOR_PASSWORD")) . "&ra=" . urlencode($ip) . "&sa=" . urlencode($serverAddress) . "&sp=443";
 
@@ -196,9 +202,9 @@ class HumanVerification
         curl_close($ch);
 
         if ($httpcode === 200) {
-            return "999.999.999.999";
+            return true;
         } else {
-            return $ip;
+            return false;
         }
     }
 }