<?php
require_once __DIR__.'/includes/config.php';
require_login();
$db=db();
if($_SERVER['REQUEST_METHOD']==='POST'){
    $portals=[];
    for($i=1;$i<=20;$i++){
        $portals[$i] = $_POST['portal'.$i] ?? '';
    }
    save_dns_row($portals);
    header('Location: dns.php?ok=1'); exit;
}
$row=get_dns_row();
include __DIR__.'/includes/header.php';
?>
<div class="card"><h3>Editar DNS</h3><p class="muted">Lista individual: <?=h(dns_owner_label())?></p><form method="post"><?php for($i=1;$i<=20;$i++): ?><label>Portal <?=$i?></label><input name="portal<?=$i?>" value="<?=h($row['portal'.$i]??'')?>" placeholder="http://ip-ou-dominio:porta"><?php endfor; ?><button class="btn">Salvar</button> <a class="btn gray" href="dns.php">Voltar</a></form></div>
<?php include __DIR__.'/includes/footer.php'; ?>
