Ejemplo n.º 1
0
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
require "../../../init.php";
require "vpsnet.php";
if (!$_SESSION['uid']) {
    exit("Access Denied");
}
$result = select_query("tblhosting", "count(*)", array("id" => $serviceid, "userid" => $_SESSION['uid']));
$data = mysql_fetch_array($result);
if (!$data[0]) {
    exit("Access Denied");
}
$creds = vpsnet_GetCredentials();
$api = VPSNET::getinstance($creds['username'], $creds['accesshash']);
$result = select_query("mod_vpsnet", "", array("relid" => $serviceid));
while ($data = mysql_fetch_array($result)) {
    ${$data['setting']} = $data['value'];
}
if (!in_array($period, array("hourly", "daily", "weekly", "monthly"))) {
    $period = "hourly";
}
$postfields = new VirtualMachine();
$postfields->id = $netid;
try {
    if ($graph == "cpu") {
        $result = $postfields->showCPUGraph($period);
    } else {
        $result = $postfields->showNetworkGraph($period);
    }
Ejemplo n.º 2
0
 /**
  * Removes a virtual machine
  * @return boolean true if virtual machine was removed, false otherwise
  */
 public function remove()
 {
     $api = VPSNET::getInstance();
     if ($this->id < 1) {
         trigger_error("To call VirtualMachine::remove() you must set its id", E_USER_ERROR);
         return false;
     }
     $api->setAPIResource('virtual_machines/' . $this->id);
     $result = $api->sendDELETERequest();
     $this->deleted = $result['info']['http_code'] == 200;
     return $this->deleted;
 }