Esempio n. 1
0
function init()
{
    require_once './../hhb_.inc.php';
    hhb_init();
}
Esempio n. 2
0
<?php

hhb_init();
$pass = "******";
if (php_sapi_name() !== 'cli' && (!array_key_exists('password', $_GET) || $_GET['password'] !== $pass)) {
    header('HTTP/1.0 403 Forbidden');
    die("wrong password");
}
$cp_username = '******';
//SoulsVM control panel username
$cp_password = '******';
//SoulsVM control panel password
$vps_hostname = 'ramnodesite.com';
//the VM's hostname, exactly as it is named in the control panel's list of VMs on your account.
$ch = hhb_curl_init(array(CURLOPT_TIMEOUT => 20));
$headers = array();
$cookies = array();
$verboseDebugInfo = "";
$html = hhb_curl_exec2($ch, "https://vpscp.ramnode.com/login.php", $headers, $cookies, $verboseDebugInfo);
assert(stripos($html, "Username") !== false);
//hhb_var_dump($headers,$cookies,$verboseDebugInfo,$html);
curl_setopt_array($ch, array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('X-Requested-With: XMLHttpRequest', 'Accept: application/json, text/javascript, */*; q=0.01'), CURLOPT_POSTFIELDS => http_build_query(array('act' => 'login', 'Submit' => '1', 'username' => $cp_username, 'password' => $cp_password))));
$html = hhb_curl_exec2($ch, "https://vpscp.ramnode.com/login.php", $headers, $cookies, $verboseDebugInfo);
$resp = json_decode($html);
assert($resp->success === '1');
unset($resp);
//hhb_var_dump($headers,$cookies,$verboseDebugInfo,$html);
curl_setopt_array($ch, array(CURLOPT_HTTPGET => true, CURLOPT_HTTPHEADER => array()));
$html = hhb_curl_exec2($ch, "https://vpscp.ramnode.com/home.php", $headers, $cookies, $verboseDebugInfo);
assert(false !== stripos($html, 'VPS Control'));
assert(false !== stripos($html, $vps_hostname));
function init()
{
    require_once './../hhb_.inc.php';
    hhb_init();
    //header("content-type: application/json;charset=utf8");
    //I wish i could use the application/json, but it does not play well with Internet Explorer.
    header("content-type: text/plain;charset=utf8");
}