Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. $maxs[0] = '0|Flood';
  2. $maxs[1] = '20|Ban ASN';
  3. $maxs[2] = '80|Max Conn.';
  4. $maxs[3] = '40|DDoS';  
  5.  
  6.  public function getTops($maxs, $types = null, $tops = null){
  7.         $top = 0;
  8.         $names = "";
  9.        
  10.         foreach ($maxs as $key){
  11.             $type = explode('|', $key);
  12.             $types[$type[0]] = $type[0];
  13.         }
  14.  
  15.         foreach ($types as $key){
  16.             $max = max($types);
  17.             $keyname = $key;
  18.             $name = '';
  19.            
  20.             foreach ($maxs as $key2){
  21.                 $value = explode('|', $key2);
  22.                
  23.                 if ($value[0] == $max && !(strpos($names, $value[1]) !== false)){
  24.                     $name = $value[1];
  25.                     $names .= ','. $value[1];
  26.                     break;
  27.                 }
  28.             }
  29.            
  30.             $tops[$top]['Name'] = $name;
  31.             $tops[$top]['Progress'] = $max;
  32.             unset($types[$max]);
  33.             $top++;
  34.         }
  35.         return $tops;
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement