if (isset($_REQUEST['apikey'])) {
    if ($_REQUEST['apikey'] == "") {
        $res = 'error';
        $msg = '<div class="alert alert-error"><button class="close" data-dismiss="alert">×</button><strong>Error!</strong><br />Doh! Passwords cannot be blank!</div>';
        rsEND($res, $msg);
    } else {
        $RSAPI = $_REQUEST['apikey'];
    }
} else {
    $RSAPI = $_COOKIE['rxalarm']['rsapi'];
}
if (!isset($_REQUEST['location'])) {
    // no blank capture required, as the default is US-of-A.
    $RSLOC = $_COOKIE['rxalarm']['rsloc'];
} else {
    $RSLOC = $_REQUEST['location'];
}
$CacheAuthKey = $user['uid'] . "_rsauth";
// Store Data in a user unique key
if (!($Auth = apc_fetch($CacheAuthKey))) {
    $Auth = new RackAuth($RSUID, $RSAPI, $RSLOC);
    $Auth->auth();
    $LastCode = Request::getLastHTTPCode();
    $AuthError = Request::getLastError();
    #error_log($AuthError, 0);
    if ($LastCode < 304) {
        apc_store($CacheAuthKey, $Auth, "43200");
        // cache auth for 12hrs (http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/general-api-info-authentication.html#token-expiration)
    }
    #error_log("==[FRESH AUTH]==", 0);
}
<?php

/**

	/Console -> Config Tab -> Server -> Delete

	**/
$entityid = $_REQUEST['entityid'];
require_once "../libs/console_data_apikey.php";
// bootstap the API.
$Url = "entities/" . trim($entityid);
$JsonResponse = Request::postAuthenticatedDeleteRequest($Url, $Auth);
$Response = json_decode($JsonResponse);
$LastCode = Request::getLastHTTPCode();
if ($LastCode == "204") {
    $CacheSvrsKey = $user['uid'] . "_ent";
    // Cached Entities
    apc_delete($CacheSvrsKey);
    // purge the cache (to show the changes at next refresh)
    $res = 'ok';
    $msg = '<div class="alert alert-success"><button class="close" data-dismiss="alert">×</button><strong>Delete Sucessful!</strong><br />Your server (<em>entity</em>) has been deleted.</div>';
    $ok = '';
} else {
    $RSError = Request::getLastError();
    $RSErrorCode = "{$LastCode}";
    $res = 'error';
    $msg = '<div class="alert alert-error"><button class="close" data-dismiss="alert">×</button><strong>Error!</strong><br />Oops, Something went wrong. - Delete Failed. ($RSErrorCode: $RSError)</div>';
}
$output = array('response' => $res, 'msg' => $msg, 'ok' => $ok);
output_json($output);
示例#3
0
<?php

include_once 'lib/functions.php';
$cookieValue = checkCookieExists("info");
$cookieValue = getCookieData($cookieValue);
$userName = $cookieValue['userName'];
$authKey = $cookieValue['authKey'];
$software = $cookieValue['software'];
$auth = new RackAuth($userName, $authKey);
@$auth->auth();
$lastHTTPCode = Request::getLastHTTPCode();
$lastErrorMessage = Request::getLastError();
if ($lastHTTPCode == 204) {
    $apiAuthInfo = array('XAuthToken' => $auth->getXAuthToken(), 'XStorageToken' => $auth->getXStorageToken(), 'XStorageUrl' => $auth->getXStorageUrl(), 'XServerManagementUrl' => $auth->getXServerManagementUrl(), 'XCDNManagementUrl' => $auth->getXCDNManagementUrl());
    $cookieContent = makeCookie($apiAuthInfo);
    setMyCookie("apidetails", $cookieContent, 3600);
}
include 'header2.php';
ob_start();
if ($software == "magento") {
    print "<p>Since you have chosen Magento, you may want to choose a size larger than 4Gb.</p>";
}
if ($debug) {
    echo "<p>HTTPCode: {$lastHTTPCode}<br>\nErrorMessage: {$lastErrorMessage}</p>\n";
}
if ($lastHTTPCode == (401 | 403)) {
    print "There seems to be a problem with your authentication info. Please <a href=\"/\">try again</a>.";
    include 'footer2.php';
    exit(1);
}
if ($lastHTTPCode == 413) {