Ejemplo n.º 1
0
        // Store Data in a user unique key
        $UseCache = true;
        // by default use the cache
        if ($_REQUEST['r'] == "1") {
            // allow the user to manually refresh
            $UseCache = false;
        } else {
            if (!($CacheAudits = apc_fetch($CacheAuditKey))) {
                // check the cache
                $UseCache = false;
            }
        }
        if (!$UseCache) {
            // fail, got to rackspace.
            $Url = "audits";
            $JsonResponse = Request::postAuthenticatedRequest($Url, $Auth);
            $Response = json_decode($JsonResponse);
            $CacheAudits = apc_store($CacheAuditKey, $Response, "3600");
            if (!$CacheAudits) {
                ?>
<div class="alert alert-warning"><strong>Warning!</strong><br />There is something wrong with the [rx]Alarm Cache.</div><?php 
            }
            $Cache = false;
            $CacheAudits = $Response;
        } else {
            $Cache = true;
            // Cache is gooood!
        }
        ?>

			<div style="float:right;padding-top:10px;">
// array counter
foreach ($_REQUEST['addip'] as $IP) {
    // fix the multiple ipaddresses for use!
    $ipname = $_REQUEST['addipname'][$ipcounter];
    $ip_addresses[$ipname] = $IP;
    $ipaddresforform[$ipcounter] = array($ip, $ipname);
    $ipaddr .= $IP . ' <em>' . $ipname . '</em> <br/>';
    $ipcounter++;
}
require_once "../libs/console_data_apikey.php";
// bootstap the API.
$Request = array("label" => $label, "ip_addresses" => $ip_addresses);
// array for changes
$JsonRequest = json_encode($Request);
$Url = "entities";
$Response = Request::postAuthenticatedRequest($Url, $Auth, $JsonRequest, true);
$Headers = Request::parseHeaders($Response);
// the new server/enity ID is hidden in the Location Header returned.
$HiddenEntityID = explode("/", $Headers['Location']);
$entityid = $HiddenEntityID['6'];
$LastCode = Request::getLastHTTPCode();
if ($LastCode == "201") {
    // 201 is good, all else is bad.
    $res = 'ok';
    $res = 'ok';
    $msg = '<div class="alert alert-success"><button class="close" data-dismiss="alert">×</button><strong>Update Sucessful!</strong><br />Server has been saved.</div>';
    $ok = '<tr>
					<td>
					<form id="From-' . $entityid . '">
						<input type="hidden" name="d" value="tab" />
						<input type="hidden" name="i" value="sve" />