コード例 #1
0
ファイル: kick.php プロジェクト: nmistry/deployitron
$imageID = $_POST['imageID'];
$flavorID = $_POST['flavorID'];
settype($imageID, "integer");
settype($flavorID, "integer");
$newServer = $cloudServers->createServer($serverName, $imageID, $flavorID, array("Description" => "Deployed by http://deployitron.com"));
$lastHTTPCode = Request::getLastHTTPCode();
$lastErrorMessage = Request::getLastError();
if ($lastHTTPCode != 202) {
    include 'header2.php';
    print "There was a problem creating the image. Maybe you should try a different image name. Please <a href=\"javascript: history.go(-1)\">try again</a>.";
    include 'footer.php';
    exit(1);
}
$newServer = object2array($newServer);
$serverInfo = array('serverID' => $newServer['server']['id'], 'serverPwd' => $newServer['server']['adminPass'], 'serverAddresses' => $newServer['server']['addresses']);
$cookieContent = makeCookie($serverInfo);
setMyCookie("serverdetails", $cookieContent, 3600);
// Add info to the DB for analysis
require_once 'MDB2.php';
$dsn = "mysql://{$dbuser}:{$dbpasswd}@{$dbhost}/{$dbname}";
$options = array('persistent' => true);
$mdb2 =& MDB2::factory($dsn, $options);
$userName = md5($userName);
$sql = "SELECT * FROM user_info WHERE username='******'";
$result = $mdb2->query($sql);
$data = $result->fetchAll();
$result->free();
$data = $mdb2->queryAll($sql);
if (empty($data)) {
    $sql = "INSERT INTO user_info (username,count) VALUES (\"{$userName}\",1);";
    $statement = $mdb2->prepare($sql);
コード例 #2
0
ファイル: info.php プロジェクト: nmistry/deployitron
<?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) {
コード例 #3
0
ファイル: login.php プロジェクト: nmistry/deployitron
<?php

include_once 'lib/functions.php';
$userName = $_POST['username'];
$authKey = $_POST['authkey'];
$software = $_POST['software'];
if (!preg_match('/^[a-z][0-9a-z]{2,15}$/', $userName)) {
    include 'header.php';
    print "There seems to be a problem with your username. Please <a href=\"javascript: history.go(-1)\">try again</a>.";
    include 'footer2.php';
    exit(1);
}
if (strlen($authKey) != 32) {
    include 'header.php';
    print "There seems to be a problem with your authkey. Please <a href=\"javascript: history.go(-1)\">try again</a>.";
    include 'footer2.php';
    exit(1);
}
if (empty($software)) {
    include 'header.php';
    print "You must choose a software package to install. Please <a href=\"javascript: history.go(-1)\">try again</a>.";
    include 'footer2.php';
    exit(1);
}
$info = array('userName' => $userName, 'authKey' => $authKey, 'software' => $software);
$cookieContent = makeCookie($info);
setMyCookie("info", $cookieContent, 3600);
header('Location: http://' . $_SERVER['SERVER_NAME'] . '/info.php');