admin.php 840 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. error_reporting(E_ALL);
  3. require_once 'action.php';
  4. require_once 'db.php';
  5. require_once 'token.php';
  6. require_once 'stats.php';
  7. $ip = ip2long(substr(trim($_GET['ip']),0,15));
  8. $token = substr(trim($_GET['token']),0,25);
  9. $action = substr(trim($_GET['action']),0,9);
  10. $stats = true;
  11. if (!(new token)->isAdmin($token)) {
  12. echo "admin access denied";
  13. exit;
  14. }
  15. if($stats == true) {
  16. (new stats)->log($ip,$action,$token);
  17. }
  18. switch($action) {
  19. case 'blacklist':
  20. if((new action)->blackList($ip)){
  21. echo " blacklisted " . long2ip($ip) ."\n";
  22. } else {
  23. echo " fehler\n";
  24. };
  25. break;
  26. case 'whitelist':
  27. if((new action)->whiteList($ip)){
  28. echo " whitelisted " . long2ip($ip) ."\n";
  29. } else {
  30. echo " fehler\n";
  31. };
  32. break;
  33. }