Browse Source

add protection

andre 4 năm trước cách đây
mục cha
commit
3e12b444ae
3 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 3 3
      admin.php
  2. 1 1
      index.php
  3. 3 3
      stats.php

+ 3 - 3
admin.php

@@ -41,10 +41,10 @@ $stats = true;
 $tok = new token;
 $tok = new token;
 $act = new action;
 $act = new action;
 
 
-/*if($act->isBlocked($clientIP)) {
+if($act->isBlocked($clientIP)) {
     http_response_code(403);
     http_response_code(403);
     exit;
     exit;
-}*/
+}
 
 
 if (!$tok->isAdmin($token)) {
 if (!$tok->isAdmin($token)) {
     $act->block($clientIP);
     $act->block($clientIP);
@@ -52,7 +52,7 @@ if (!$tok->isAdmin($token)) {
     exit;
     exit;
 }
 }
 if($stats == true) {
 if($stats == true) {
-    (new stats)->log($ip,$action,$token);
+    (new stats)->log($clientIP,$ip,$action,$token);
 }
 }
 switch($action) {
 switch($action) {
     case 'deluser':
     case 'deluser':

+ 1 - 1
index.php

@@ -25,7 +25,7 @@ if (!(new token)->isReporter($token)) {
     exit;
     exit;
 }
 }
 if($stats == true) {
 if($stats == true) {
-    (new stats)->log($ip,$action,$token);
+    (new stats)->log($clientIP,$ip,$action,$token);
 }
 }
 switch($action) {
 switch($action) {
     case 'delist':
     case 'delist':

+ 3 - 3
stats.php

@@ -6,9 +6,9 @@ class stats {
         $this->db = new db();
         $this->db = new db();
     }
     }
 
 
-    public function log($ip,$action,$token) {
-        $dbAction = $this->db->prepare("INSERT IGNORE INTO stats (ip,action,token) VALUES (?,?,?)");
-        $dbAction->bind_param('iss',$ip,$action,$token);
+    public function log($clientIP,$ip,$action,$token) {
+        $dbAction = $this->db->prepare("INSERT IGNORE INTO stats (clientip,ip,action,token) VALUES (?,?,?,?)");
+        $dbAction->bind_param('iiss',$clientIP,$ip,$action,$token);
         return $dbAction->execute();
         return $dbAction->execute();
     }
     }
 }
 }