Beispiel #1
0
                    }
                    fclose($handle);
                    $stmt->close();
                }
                $warns = array();
                foreach ($warn as $line => $wid) {
                    $warns[] = implode('|', array($line, $wid));
                }
                $warns = implode(',', $warns);
                unlink($filename);
                $db->query("UPDATE `tasks` SET `lines`='{$i}',`accepted`='{$cnt}',`warns`='{$warns}',`tstate`='2' WHERE `tid`='{$tid}'");
                if (!$nowait) {
                    $db->close();
                    require 'chkxy.php';
                    if (!db_connect()) {
                        break;
                    }
                    $found = CheckLocation($db, $aps, $tid);
                    $db->close();
                    if (!db_connect()) {
                        break;
                    }
                    $db->query("UPDATE `tasks` SET `onmap`='{$found}',`tstate`='3' WHERE `tid`='{$tid}'");
                    sleep(60);
                }
                $db->query("DELETE FROM `tasks` WHERE `tid`='{$tid}'");
                $db->close();
            }
            break;
    }
}
<?php

ignore_user_abort(true);
set_time_limit(36000);
chdir('..');
header("Content-type: text/plain");
if (is_file('./settings/checkTesters.inc')) {
    if (include './settings/checkTesters.inc') {
        if (isset($agents) && is_array($agents)) {
            foreach ($agents as $url => &$locations) {
                echo "Checking {$url}\n";
                CheckLocation($url, $locations);
            }
        }
    }
}
function CheckLocation($url, &$locations)
{
    $doc = new MyDOMDocument();
    if ($doc) {
        $response = file_get_contents($url);
        if (strlen($response)) {
            $response = preg_replace('/[^(\\x20-\\x7F)]*/', '', $response);
            $doc->loadXML($response);
            $data = $doc->toArray();
            $status = (int) $data['response']['statusCode'];
            if ($status == 200) {
                foreach ($locations as $location => &$testers) {
                    foreach ($testers as $tester => &$cmd) {
                        CheckTester($data, $location, $tester, $cmd);
                    }