$identity['sessionRef'],'banId'=>$banId,'operation'=>'lookup']);if($record&&isset($record['ban'])){$ban=$record['ban'];$evidence=$record['evidence']??[];}else $error='We could not find or verify that ban ID. Check the full ID in your ban message, or use Appeal on the public ban list.';}
$debugMode=!empty($ban['demo'])&&!empty($record['debugAllowed'])&&($_POST['debug']??$_GET['debug']??'')==='1';
if($_SERVER['REQUEST_METHOD']==='POST'){
$what=trim($_POST['whatHappened']??'');$why=trim($_POST['reviewReason']??'');$link=trim($_POST['evidenceLink']??'');
if(!$ban)$error='Find a valid ban record before submitting your appeal.';
elseif(!empty($ban['demo'])&&!$debugMode)$error='This demonstration record is a preview only. No support ticket or punishment is created.';
elseif(!empty($record['pendingTicketId'])){header('Location: /tickets.php?id='.(int)$record['pendingTicketId']);exit;}
elseif(!$record['live']&&!$debugMode)$error='The game ban list is temporarily unavailable. Your text is kept below; try again shortly.';
elseif(strlen($what)<20||strlen($what)>6000||strlen($why)<20||strlen($why)>6000)$error='Complete both appeal sections using 20–6000 characters each.';
elseif(empty($_POST['acknowledge']))$error='Confirm that you understand the appeal remains under review while the ban stays active.';
elseif($link&&(!filter_var($link,FILTER_VALIDATE_URL)||strtolower(parse_url($link,PHP_URL_SCHEME)??'')!=='https'||strlen($link)>2000||parse_url($link,PHP_URL_USER)))$error='Use a complete HTTPS link without a username or password.';
else{
$files=AttachmentFile::format($_FILES['evidence']??[])?:[];
if(count($files)>5)$error='Attach at most five files.';
foreach($files as$file){$mime=is_uploaded_file($file['tmp_name']??'')?mime_content_type($file['tmp_name']):'';if(($file['error']??0)||($file['size']??0)>5*1024*1024||!in_array($mime,['image/png','image/jpeg','image/webp','text/plain'],true)){$error='Use PNG, JPEG, WebP or plain text logs, up to 5 MB per file.';break;}}
if(!$error){
$summary="BAN APPEAL\nBan ID: ".$ban['id']."\nPlayer: ".$ban['player_name']."\nBanned by: ".$ban['banned_by']."\nScope: ".$ban['scope']."\nIssued: ".$ban['created_text']."\nExpires: ".$ban['expires_text']."\nRecorded reason: ".$ban['reason']."\n\nWHAT HAPPENED\n".$what."\n\nWHY THIS SHOULD BE REVIEWED\n".$why.($link?"\n\nSUPPORTING LINK\n".$link:'');
$message=nl2br(esc($summary));foreach(['BAN APPEAL','WHAT HAPPENED','WHY THIS SHOULD BE REVIEWED','SUPPORTING LINK']as$heading)$message=str_replace($heading,'
'.$heading.'
',$message);
$vars=['uid'=>$thisclient->getId(),'name'=>$identity['username'],'email'=>$identity['id'].'@accounts.dunerealms.invalid','topicId'=>2,'subject'=>($debugMode?'[DEBUG] Ban appeal · ':'Ban appeal · ').$ban['id'].' · '.$ban['player_name'],'message'=>$message,'source'=>'Web','ip'=>$_SERVER['REMOTE_ADDR'],'files'=>$files,'autorespond'=>false];
$createErrors=[];$ticket=Ticket::create($vars,$createErrors,'API',false,false);
if(!$ticket)$error='The appeal could not be saved. Check the information below and try again. Your appeal text has been kept.';
else{
$attached=dune_bridge('ban',['sessionRef'=>$identity['sessionRef'],'banId'=>$ban['id'],'operation'=>'attach','ticketId'=>$ticket->getId(),'debug'=>$debugMode]);
if(!$attached||empty($attached['ok']))$ticket->postNote(['title'=>'Ban association requires review','note'=>'Ban ID '.$ban['id'].' is preserved in the appeal. Automatic association was not confirmed; staff must verify it.'],false);
header('Location: /tickets.php?id='.$ticket->getId());exit;
}
}
}
}
?>Appeal a ban · DuneRealms
Support / Ban appeals
Appeal a ban
Ask staff to review a ban. A linked Minecraft account is not required.
01 Find your ban02 Review the record03 Send your appeal
Unable to continue: =esc($error)?>
Find your ban
Find this ID in your ban message or use “Appeal” on the public ban list.