Ejemplo n.º 1
0
$oR3DCQuery = new CR3DCQuery($config);
$oBilling = new CBilling($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
$RequiresPayment = $oBilling->IsPaymentEnabled();
if (!$bCronEnabled) {
    if ($oR3DCQuery->ELOIsActive()) {
        $oR3DCQuery->ELOCreateRatings();
    }
    $oR3DCQuery->MangeGameTimeOuts();
}
if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) {
    $user = trim($_POST['txtName']);
    $pass = trim($_POST['txtPassword']);
    if ($user != "" && $pass != "") {
        $sid = $oR3DCQuery->Login($user, $pass);
        $id = $oR3DCQuery->GetIDByUserID($config, $user);
        if ($sid != "") {
            $_SESSION['sid'] = $sid;
            $_SESSION['user'] = $user;
            $_SESSION['id'] = $id;
            $_SESSION['password'] = $pass;
            $_SESSION['language'] = $languagefile;
            //Get Chessboard colors
            $d = "";
            $l = "";
            $oR3DCQuery->GetChessBoardColors($config, $_SESSION['id'], $l, $d);
            $_SESSION['lcolor'] = $l;
            $_SESSION['dcolor'] = $d;
            if ($oR3DCQuery->IsPlayerDisabled($id) == false) {
                //Create the cookie if auto login
Ejemplo n.º 2
0
// $oR3DCQuery->MangeGameTimeOuts();
// $oR3DCQuery->Close();
// unset($oR3DCQuery);
// return $bValid;
// }
// Main Application Code
switch ($action) {
    ////////////////////////////////////////////////////////////////////////////////////////////
    // LOGIN
    // Params: action, user, pass
    ////////////////////////////////////////////////////////////////////////////////////////////
    case "login":
        if ($_GET['user'] != "" && $_GET['pass'] != "") {
            //Instantiate the CR3DCQuery Class
            $oR3DCQuery = new CR3DCQuery($config);
            $sid = $oR3DCQuery->Login($_GET['user'], $_GET['pass']);
            if ($sid != "") {
                $session = base64_decode($sid);
                list($uniq, $player_id) = preg_split("/\\|/", $session);
                /////////////////////////////////////////////
                // Point caching
                /////////////////////////////////////////////
                $oR3DCQuery->GetPlayerStatusrRefByPlayerID($ConfigFile, $player_id, $x_wins, $x_loss, $x_draws);
                $xPoints = 0;
                if ($oR3DCQuery->ELOIsActive()) {
                    $xPoints = $oR3DCQuery->ELOGetRating($player_id);
                } else {
                    $xPoints = $oR3DCQuery->GetPointValue($x_wins, $x_loss, $x_draws);
                }
                $oR3DCQuery->SetChessPointCacheData($player_id, $xPoints);
                /////////////////////////////////////////////