Ejemplo n.º 1
0
     $smarty->assign('name', $row['host']);
     $smarty->assign('address', $row['val']);
     $smarty->assign('type', get_type($row['type']));
     $smarty->assign('distance', $row['distance']);
     $smarty->assign('weight', $row['weight']);
     $smarty->assign('port', $row['port']);
     $smarty->assign('ttl', $row['ttl']);
     set_msg_err(htmlentities($result, ENT_QUOTES));
     $smarty->display('header.tpl');
     $smarty->display('edit_record.tpl');
     $smarty->display('footer.tpl');
     exit;
 } else {
     // Update record
     if ($_REQUEST['type'] == 'AAAA' || $_REQUEST['type'] == 'AAAA+PTR') {
         $address = uncompress_ipv6($_REQUEST['address']);
     } else {
         $address = $_REQUEST['address'];
     }
     if (strlen($_REQUEST['weight'])) {
         $weightstring = "weight=" . $_REQUEST['weight'] . ",";
     } else {
         $weightstring = null;
     }
     if (strlen($_REQUEST['port'])) {
         $portstring = "port=" . $_REQUEST['port'] . ",";
     } else {
         $portstring = null;
     }
     $q = "update records set " . "host='{$name}'," . "val='" . $address . "'," . "distance='" . $_REQUEST['distance'] . "'," . $weightstring . $portstring . "ttl='" . $_REQUEST['ttl'] . "' " . "where record_id='" . $_REQUEST['record_id'] . "' and domain_id='" . get_dom_id($domain) . "'";
     $pdo->query($q) or die(print_r($pdo->errorInfo()));
Ejemplo n.º 2
0
function ipv6_to_ptr_record($ip, $domain, $ttl)
{
    $ip = uncompress_ipv6($ip);
    $parts = array_reverse(explode(':', $ip));
    $characters = array();
    foreach ($parts as $part) {
        for ($i = 3; $i > -1; $i--) {
            $characters[] = $part[$i];
        }
    }
    return '^' . implode('.', $characters) . '.ip6.arpa:' . $domain . ':' . $ttl . "\n";
}