if ($deleteGroup != '') { $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'; ?>
$textMessageEmails = ""; 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';
class_exists('_MySQL', false) or (include 'classes/_MySQL.class.php'); class_exists('_FileCache', false) or (include 'classes/_FileCache.class.php'); $username = array_key_exists('username', $_POST) ? trim($_POST['username']) : ''; $passwd = array_key_exists('passwd', $_POST) ? trim($_POST['passwd']) : ''; $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);
$data = array_key_exists('data', $_POST) ? trim($_POST['data']) : ''; $groupName = array_key_exists('groupName', $_POST) ? trim($_POST['groupName']) : ''; $result = array('status' => '', 'result' => array()); $id = Utilities::validateLogin($username, $passwd, true, $apiKey); if ($id == 0) { $result['status'] = 'invalid login'; output(); } switch ($type) { 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);