<?php

define("DB_SERVER", "127.0.0.1");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "qwer");
define("DB_DB", "NewDns");
$path = dirname(__FILE__);
require_once "{$path}/mysqlconnection.php";
define("DOMAIN_OLD_FILENAME", "{$path}/extend_memory.txt");
define("DOMAIN_DIFF_FILENAME", "{$path}/extend_differ.txt");
openlog("make-domain-differ", LOG_ODELAY, LOG_LOCAL3);
//copy_view_file();
//get_view_file();
$old_view = getVeiws(DOMAIN_OLD_FILENAME);
$new_view = get_view_from_mysql();
$diffs = compare_views($old_view, $new_view);
write_didder($diffs);
closelog();
function getVeiws($file)
{
    $views = array();
    if (!is_file($file)) {
        return $views;
    }
    $fh = fopen($file, 'r');
    while ($line = fgets($fh)) {
        if (preg_match('/^(.*?)\\|(.*?)\\|(.*)$/', $line, $found)) {
            $ipaddrs = trim($found[3]);
            $tok = strtok($ipaddrs, " ");
            while ($tok !== false) {
                $views[$found[1]][$found[2]][$tok] = 1;
Beispiel #2
0
<?php

define("DB_SERVER", "127.0.0.1");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "qwer");
define("DB_DB", "NewDns");
$path = dirname(__FILE__);
require_once "{$path}/mysqlconnection.php";
define("VIEW_OLD_FILENAME", "{$path}/view_memory.txt");
define("VIEW_DIFF_FILENAME", "{$path}/view_differ.txt");
//copy_view_file();
//get_view_file();
$old_view = getVeiws(VIEW_OLD_FILENAME);
$new_view = get_view_from_mysql();
$diffs = compare_views($old_view, $new_view);
write_didder($diffs);
function getVeiws($file)
{
    $views = array();
    if (!is_file($file)) {
        return $views;
    }
    $fh = fopen($file, 'r');
    while ($line = fgets($fh)) {
        if (preg_match('/^(.*?)\\|(.*)$/', $line, $found)) {
            $ipaddrs = trim($found[2]);
            if ($ipaddrs == "") {
                $views[$found[1]] = array();
                continue;
            }
            $tok = strtok($ipaddrs, " ");
Beispiel #3
0
define("DB_SERVER", "127.0.0.1");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "qwer");
define("DB_DB", "EflyDns");
define("DEFAULT_IP", "0.0.0.0");
$path = dirname(__FILE__);
require_once "{$path}/mysqlconnection.php";
define("INDEX_OLD_FILENAME", "{$path}/index_memory.txt");
define("INDEX_NEW_FILENAME", "{$path}/index_mysql.txt");
define("INDEX_DIFF_FILENAME", "{$path}/index_differ.txt");
openlog("make-index-differ", LOG_ODELAY, LOG_LOCAL3);
//copy_view_file();
get_view_file();
$old_view = getVeiws(INDEX_OLD_FILENAME);
$new_view = getVeiws(INDEX_NEW_FILENAME);
$diffs = compare_views($old_view, $new_view);
write_differ($diffs);
closelog();
function getVeiws($file)
{
    $views = array();
    if (!is_file($file)) {
        return $views;
    }
    $fh = fopen($file, 'r');
    while ($line = fgets($fh)) {
        if (preg_match('/^id:(.*?)\\|view_ip:(.*?)\\|view_action:(.*?)\\|$/', $line, $found)) {
            $views[$found[1]]["view_ip"] = $found[2];
            $views[$found[1]]["view_action"] = $found[3];
        }