index.php 707 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. error_reporting(E_ALL);
  3. require_once 'action.php';
  4. require_once 'db.php';
  5. require_once 'token.php';
  6. $ip = ip2long(substr(trim($_GET['ip']),0,15));
  7. $token = substr(trim($_GET['token']),0,25);
  8. $action = substr(trim($_GET['action']),0,9);
  9. if (!(new token)->isClient($token)) {
  10. echo "client access denied";
  11. exit;
  12. }
  13. switch($action) {
  14. case 'delist':
  15. if((new action)->delist($ip)){
  16. echo long2ip($ip) . " delisted\n";
  17. } else {
  18. echo long2ip($ip) . " not delisted\n";
  19. };
  20. break;
  21. default:
  22. if((new action)->list($ip)){
  23. echo " inserted " . long2ip($ip) ."\n";
  24. } else {
  25. echo " fehler\n";
  26. };
  27. }