コード例 #1
0
ファイル: data.php プロジェクト: no2key/VegaDNS
 *
 * CREDITS:
 * Written by Bill Shupp
 * <*****@*****.**>
 *
 * LICENSE:
 * This software is distributed under the GNU General Public License
 * Copyright 2003-2012, Bill Shupp
 * see COPYING for details
 *
 */
if (!ereg(".*/index.php\$", $_SERVER['PHP_SELF'])) {
    header("Location:../index.php");
    exit;
}
// build data
$q = "select a.domain, b.host, b.type, b.val, b.distance, b.weight, b.port, b.ttl  from domains a left join records  b on a.domain_id = b.domain_id where a.status='active' order by a.domain, b.type, b.host, b.val";
$result = mysql_query($q) or die(mysql_error());
$out = "";
$lastdomain = "";
while ($row = mysql_fetch_array($result)) {
    // Set comment if it's the beginning of a new domain
    if ($lastdomain != $row['domain']) {
        $out .= "\n#" . $row['domain'] . "\n";
    }
    // Get records
    $out .= build_data_line($row, $row['domain']);
    $lastdomain = $row['domain'];
}
print $out;
exit;
コード例 #2
0
ファイル: data.php プロジェクト: impelling/VegaDNS
 * Copyright 2003-2015, Bill Shupp
 * see COPYING for details
 *
 */
if (!preg_match('/.*\\/index.php$/', $_SERVER['PHP_SELF'])) {
    header("Location:../index.php");
    exit;
}
// build data
$q = "select a.domain, b.host, b.type, b.val, b.distance, b.weight, b.port, b.ttl  from domains a left join records  b on a.domain_id = b.domain_id where a.status='active' order by a.domain, b.type, b.host, b.val";
$stmt = $pdo->query($q) or die(print_r($pdo->errorInfo()));
$out = "";
$lastdomain = "";
while ($row = $stmt->fetch()) {
    // Set comment if it's the beginning of a new domain
    if ($lastdomain != $row['domain']) {
        $out .= "\n#" . $row['domain'] . "\n";
    }
    // Get records
    $out .= build_data_line($row, $row['domain']);
    $lastdomain = $row['domain'];
}
if (isset($vegadns_generation_txt_record)) {
    $timestamp = get_latest_log_timestamp();
    $sum = md5($out);
    $row = array('type' => 'T', 'host' => $vegadns_generation_txt_record, 'val' => $timestamp . '-' . $sum, 'ttl' => 3600);
    $generation_record = build_data_line($row, "notused_for_txt");
    $out .= "\n# VegaDNS Generation TXT Record\n{$generation_record}";
}
print $out;
exit;