Example #1
0
<?php

echo 'Creating account...';
require_once './getpassword.php';
$password = getpassword();
require_once 'getconfig.php';
$handle = getconfig('username');
if (!file_exists('./publishserver.conf.php')) {
    echo 'publish server is not set, using server as a fallback.' . "\n";
    $publishserver = getconfig('server');
} else {
    $publishserver = getconfig('publishserver');
}
$ch = curl_init($publishserver . '/?accountcreator=accountcreator');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('password' => $password, 'username' => $handle));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch) . "\n";
curl_close($ch);
Example #2
0
/**
 * Determine if a user/password session exists
 *
 * @return True if user has a session, false otherwise
 */
function is_logged()
{
    if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
        return true;
    } else {
        return false;
    }
}
Example #3
0
 * @param $cont    The xCAT table contents
 * @return The xCAT response.  Replies are in the form of JSON
 */
if (isset($_POST["table"])) {
    // HTTP POST requests
    $tab = $_POST["table"];
    $cont = $_POST["cont"];
}
// Create xCAT request
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
// Command is tabrestore
$request->addChild('command', 'tabrestore');
// Setup authentication
$usernode = $request->addChild('becomeuser');
$usernode->addChild('username', $_SESSION["username"]);
$usernode->addChild('password', getpassword());
// Go through each table row
$first = 0;
foreach ($cont as $line) {
    if ($first == 0) {
        // The 1st line is the table header
        // It does not need special processing
        // Create string containing all array elements
        $str = implode(",", $line);
        $request->addChild('data', $str);
        $first = 1;
        continue;
    }
    // Go through each column
    foreach ($line as &$col) {
        // If the column does begins and end with a quote
Example #4
0
    $query .= '&q=0';
}
if (isset($_POST['f'])) {
    $pythonProcess = exec('ps -aef | grep -v grep | grep ajaxterm.py');
    if ('' == $pythonProcess) {
        exec('nohup ' . dirname(__FILE__) . '/ajaxterm/ajaxterm.py >/dev/null 2>&1 &');
    }
    sleep(1);
    $temp = $query . '&k=' . urlencode($_SESSION["username"] . "\r");
    $output = rconsSynchronise($temp);
    if (0 < substr_count($output, 'error')) {
        echo json_encode(array('err' => $output));
        exit;
    }
    sleep(1);
    $temp = $query . '&k=' . urlencode(getpassword() . "\r");
    $output = rconsSynchronise($temp);
    if (0 < substr_count($output, 'error')) {
        echo json_encode(array('err' => $output));
        exit;
    }
    sleep(1);
    $temp = $query . '&c=1&k=' . urlencode('rcons ' . $_POST['s'] . "\r");
} else {
    $temp = $query . '&c=1&k=' . urlencode($_POST['k']);
}
$output = rconsSynchronise($temp);
if (0 < substr_count($output, 'error')) {
    echo array('err' => $output);
} else {
    $xml = simplexml_load_string($output);
<?php

if ($_COOKIE['user'] == '') {
    header("Location: index.php");
}
include_once 'config.php';
$id = $_POST['id'];
$login = strtolower($_POST['login']);
$nom = strtoupper($_POST['nom']);
$prenom = ucfirst($_POST['prenom']);
$password = md5($_POST['password']);
if ($password == 'd41d8cd98f00b204e9800998ecf8427e') {
    $password = getpassword($id);
}
$svc = $_POST['svc'];
$actif = $_POST['actif'];
$admin = $_POST['admin'];
if ($id > 0) {
    print update($id, $login, $nom, $prenom, $password, $svc, $actif, $admin);
} else {
    print insert($login, $nom, $prenom, $password, $svc, $actif, $admin);
}
function getpassword($id)
{
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    ////set the query
    $query = sprintf("SELECT `userpassword` FROM `users` WHERE `userid`='%s'", $id);
    $result = $mysqli->query($query);
    $row = $result->fetch_object();
    $password = $row->userpassword;
    $mysqli->close();