<?php header('Content-Type: application/json');$input=json_decode(file_get_contents('php://input'),true);$ip=$input['ip']??'';$blockedFile='../banip/blocked.txt';if(empty($ip)){echo json_encode(['status'=>'error','message'=>'No IP provided']);exit;}try{if(file_exists($blockedFile)){$ips=file($blockedFile,FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);$ips=array_filter($ips,function($line)use($ip){return trim($line)!==trim($ip);});file_put_contents($blockedFile,implode("\n",$ips)."\n");}echo json_encode(['status'=>'success']);}catch(Exception $e){echo json_encode(['status'=>'error','message'=>$e->getMessage()]);}?>