index.php 815 B

1234567891011121314151617181920212223242526272829303132333435
  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,32);
  9. $action = substr(trim($_GET['action']),0,9);
  10. $stats = true;
  11. if (!(new token)->isReporter($token)) {
  12. echo "client access denied";
  13. exit;
  14. }
  15. if($stats == true) {
  16. (new stats)->log($ip,$action,$token);
  17. }
  18. switch($action) {
  19. case 'delist':
  20. if((new action)->delist($ip)){
  21. echo long2ip($ip) . " delisted\n";
  22. } else {
  23. echo long2ip($ip) . " not delisted\n";
  24. };
  25. break;
  26. default:
  27. if((new action)->list($ip)){
  28. echo " inserted " . long2ip($ip) ."\n";
  29. } else {
  30. echo " fehler\n";
  31. };
  32. }