2021-01-22 21:58:46 +01:00
< ? php require " ../top.inc.php " ; ?>
2021-02-17 22:48:49 +01:00
< form method = " post " >
< label for = " action " > Action </ label >
< select name = " action " id = " action " >
< option value = " add " > Ajouter </ option >
< option value = " delete " > Retirer </ option >
</ select >
< br >
< label for = " ns " > Serveur de nom </ label >< br >
< input required = " " id = " ns " placeholder = " ns1.atope.art. " name = " ns " type = " text " >
< br >
< label for = " ip " > IP </ label >< br >
< input required = " " pattern = " ^[a-f0-9:.]+ $ " id = " ip " name = " ip " minlength = " 7 " maxlength = " 39 " size = " 40 " type = " text " placeholder = " 2a0b:cbc0:1103:2::106f ou 45.13.104.169 " >
< br >
< input value = " Valider " type = " submit " >
</ form >
< ? php
if ( isset ( $_POST [ 'action' ]) AND isset ( $_POST [ 'ns' ]) AND isset ( $_POST [ 'ip' ])) {
checkAbsoluteDomainFormat ( $_POST [ 'ns' ]);
checkIpFormat ( $_POST [ 'ip' ]);
if ( filter_var ( $_POST [ 'ip' ], FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ))
$record = " A " ;
else if ( filter_var ( $_POST [ 'ip' ], FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ))
$record = " AAAA " ;
else
exit ( " Unknown error about IP format " );
if ( $_POST [ 'action' ] == " delete " )
$action = " un " ;
else if ( $_POST [ 'action' ] == " add " )
$action = " " ;
else
exit ( " ERROR : Wrong value for action " );
exec ( KNOTC_PATH . " zone-begin " . $suffix );
exec ( KNOTC_PATH . " zone- " . $action . " set " . $suffix . " " . $_POST [ 'ns' ] . " 86400 " . $record . " " . $_POST [ 'ip' ]);
exec ( KNOTC_PATH . " zone-commit " . $suffix );
echo " Glue record ajouté " ;
}
?>
2021-01-22 21:58:46 +01:00
< ? php require " ../bottom.inc.php " ; ?>