Esempio n. 1
0
        $res_array = mysql_fetch_array($result);
        $salt = substr($res_array['Password'], 0, 2);
    }
    echo "1:" . $salt;
    mysql_close($link);
}
// --------------------------------------------------------------------------------------
// main
// --------------------------------------------------------------------------------------
if ($_GET["cmd"] == "ask") {
    askSalt($_GET["login"]);
    die;
}
// check cp is set (force bool)
$cp = $_GET["cp"] == "1";
if (!checkUserValidity($_GET["login"], $_GET["password"], $_GET["clientApplication"], $cp, $id, $reason, $priv, $extended)) {
    echo "0:" . $reason;
} else {
    if ($_GET["cmd"] == "login") {
        checkShardAccess($id, $_GET["clientApplication"], $_GET["shardid"]);
        // user selected a shard, try to add the user to the shard
        if (askClientConnection($_GET["shardid"], $id, $_GET["login"], $priv, $extended, $res, $patchURLS)) {
            // access granted, send cookie and addr
            echo "1:" . $res;
            // LS sent patching URLS? Add them at the end of the string
            if (strlen($patchURLS) > 0) {
                echo ' ' . $patchURLS;
            }
            /*
            				// OBSOLETE: emergency patch URI already sent at displayAvailableShards - no need to add it
            				// There is a default patching address? Add it at the end of the patching URLS
Esempio n. 2
0
} else {
    $cp = $_GET['cp'];
}
$submittedLang = isset($_GET['lg']) ? $_GET['lg'] : 'unknown';
if (isset($_GET['dbg']) && $_GET['dbg'] == 1) {
    $DisplayDbg = true;
}
switch ($_GET['cmd']) {
    case 'ask':
        // client ask for a login salt
        askSalt($_GET['login'], $submittedLang);
        die;
    case 'login':
        $domainId = -1;
        // client sent is login info
        if (!checkUserValidity($_GET['login'], $_GET['password'], $_GET['clientApplication'], $cp, $id, $reason, $priv, $extended, $domainId, $submittedLang)) {
            echo '0:' . $reason;
        } else {
            // retreive the domain info
            $domainInfo = getDomainInfo($domainId);
            // if we need to create missing ring info
            if ($AutoCreateRingInfo) {
                // check if the ring user exist, and create it if not
                $ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName));
                mysqli_select_db($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName));
                $query = "SELECT user_id FROM ring_users where user_id = '" . $id . "'";
                $result = mysqli_query($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
                if (mysqli_num_rows($result) == 0) {
                    // no ring user record, build one
                    $login = mysqli_real_escape_string($ringDb, $_GET['login']);
                    $query = "INSERT INTO ring_users SET user_id = '{$id}', user_name = '{$login}', user_type='ut_pioneer'";