$mysql->runQuery("delete from monitorGroup where id = {$id}");
    $mysql->runQuery("delete from monitors where monitorGroupId = {$id}");
    echo "<script>window.location='monitorGroup.php';</script>";
    exit;
}
if (isset($_POST["submit"])) {
    //TODO: make sure blacklists are domains with an ip address on them
    if ($id !== 0) {
        //update
        $mysql->runQuery("\n\t\t\tupdate monitorGroup set groupName = '" . $mysql->escape($groupName) . "',\n\t\t\t\tips = '" . $mysql->escape($ips) . "',\n\t\t\t\tdomains = '" . $mysql->escape($domains) . "'\n\t\t\twhere id = {$id}\n\t\t\t");
    } else {
        $mysql->runQuery("\n\t\t\tinsert into monitorGroup set groupName = '" . $mysql->escape($groupName) . "',\n\t\t\t\tips = '" . $mysql->escape($ips) . "',\n\t\t\t\tdomains = '" . $mysql->escape($domains) . "'\n\t\t\t");
        $id = $mysql->identity;
    }
    Utilities::updateDomains($domains, $id);
    Utilities::updateIPs($ips, $id);
    echo "<script>window.location='monitorGroup.php';</script>";
    exit;
}
$group = array('groupName' => '', 'ips' => '', 'domains' => '');
$rs = $mysql->runQuery("select * from monitorGroup where id = {$id}");
while ($row = mysqli_fetch_array($rs, MYSQL_ASSOC)) {
    $group = $row;
}
include 'header.inc.php';
?>

<?php 
include 'accountSubnav.inc.php';
?>
示例#2
0
    foreach ($ta as $e) {
        $e = trim($e);
        if (Utilities::isValidEmail($e)) {
            $textMessageEmails .= "{$e}\n";
        }
    }
    //TODO: make sure blacklists are domains with an ip address on them
    if (count($message) == 0) {
        //update
        $mysql->runQuery("\n\t\t\tupdate users set username = '******',\n\t\t\tpasswd = '" . $mysql->escape($passwdOld) . "',\n\t\t\tapiKey = '" . $mysql->escape($apiKey) . "',\n\t\t\ttwitterHandle = '" . $mysql->escape($twitterHandle) . "',\n\t\t\ttwitterHandle = '" . $mysql->escape($twitterHandle) . "',\n\t\t\tlastUpdate = '" . date('Y-m-d H:i:s') . "',\n\t\t\ttwitterHandle = '" . $mysql->escape($twitterHandle) . "',\n\t\t\tnoticeEmailAddresses = '" . $mysql->escape(trim($noticeEmailAddresses)) . "',\n\t\t\ttextMessageEmails = '" . $mysql->escape(trim($textMessageEmails)) . "',\n\t\t\tapiCallbackURL = '" . $mysql->escape($apiCallbackURL) . "',\n\t\t\tcheckFrequency = '" . $mysql->escape($checkFrequency) . "',\n\t\t\tdisableEmailNotices = {$disableEmailNotices}\n\t\t\t");
        if ($beenChecked == 1) {
            $mysql->runQuery("update users set beenChecked = 0");
            $message[] = "Check scheduled.";
        }
        Utilities::updateDomains($domains);
        Utilities::updateIPs($ips);
        if ($twitterHandle != '') {
            $t = new Twitter();
            $t->follow($twitterHandle);
        }
        $message[] = "Account updated.";
    }
}
$user = Utilities::getAccount();
if (!$user) {
    //invalid account
    echo "<script>window.location='login.php?logout=1';</script>";
    exit;
}
include 'header.inc.php';
?>
示例#3
0
$apiKey = array_key_exists('apiKey', $_POST) ? trim($_POST['apiKey']) : '';
$type = array_key_exists('type', $_POST) ? trim($_POST['type']) : '';
$data = array_key_exists('data', $_POST) ? trim($_POST['data']) : '';
$result = array('status' => '', 'result' => array());
$id = Utilities::validateLogin($username, $passwd, true, $apiKey);
if ($id == 0) {
    $result['status'] = 'invalid login';
    output();
}
switch ($type) {
    case 'updateDomains':
        Utilities::updateDomains($data);
        $result['status'] = 'success';
        break;
    case 'updateIPs':
        Utilities::updateIPs($data);
        $result['status'] = 'success';
        break;
    case 'checkHostStatus':
        $result['status'] = 'success';
        Utilities::setBlockLists();
        $result['result'] = Utilities::checkBlacklists($data);
        break;
    case 'blacklistStatus':
        $localCache = new _FileCache('blacklistmonitor-api', 90);
        $cacheKey = md5("{$username}|{$passwd}|{$apiKey}|{$type}|{$data}");
        $cacheData = $localCache->get($cacheKey);
        if ($cacheData !== false) {
            output($cacheData);
        }
        $mysql = new _MySQL();
示例#4
0
 case 'updateDomains':
     if ($groupName == '') {
         $result['status'] = 'groupName is required';
         break;
     }
     $id = Utilities::ensureGroupExists($groupName);
     Utilities::updateDomains($data, $id);
     $result['status'] = 'success';
     break;
 case 'updateIPs':
     if ($groupName == '') {
         $result['status'] = 'groupName is required';
         break;
     }
     $id = Utilities::ensureGroupExists($groupName);
     Utilities::updateIPs($data, $id);
     $result['status'] = 'success';
     break;
 case 'checkHostStatus':
     $result['status'] = 'success';
     Utilities::setBlockLists();
     $result['result'] = Utilities::checkBlacklists($data);
     break;
 case 'clearAllHostAndGroupData':
     $mysql = new _MySQL();
     $mysql->connect(Setup::$connectionArray);
     $mysql->runQuery("truncate table monitors");
     $mysql->runQuery("truncate table monitorGroup");
     $result['status'] = 'success';
     break;
 case 'blacklistStatus':