Пример #1
0
<?php

namespace MFF\ppanel;

require_once 'php/AccountUtil.php';
require_once 'php/PageRegistry.php';
require_once 'php/PPanel.php';
require_once 'php/HTTemplate.php';
require_once 'init.php';
if (!AccountUtil::isConnected($db, $sess)) {
    // Not connected, nothing to do here
    header('Location: index.php');
    exit;
}
if (isset($_GET['logoff'])) {
    AccountUtil::disconnect($sess);
    header('Location: index.php');
    exit;
}
$gaccs = $db->getGameAccountsForPanelAccId($sess->getAccountId());
$g_parm = null;
if (isset($_GET['g'])) {
    $g_parm = intval($_GET['g']);
    $isOwnGameAcc = false;
    foreach ($gaccs as $gacc) {
        if ($gacc->id == $g_parm) {
            $isOwnGameAcc = true;
            break;
        }
    }
    if ($g_parm < 1 || !$isOwnGameAcc) {
Пример #2
0
    $nickOk = !empty($nick) && strlen($nick) >= 1 && strlen($nick) <= 64;
    $passwd = $_POST['passwd'];
    $passwdOk = !empty($passwd) && strlen($passwd) >= 1 && strlen($passwd) <= 128;
    $servParm = $_POST['serv'];
    $servOk = !empty($servParm) && strlen($servParm) === 2;
    if ($servOk) {
        $serv = $servers->getByShortName($servParm);
        $servOk = $serv !== null;
        if ($servOk && $nickOk && $passwdOk) {
            $auth = $serv->getAuthEntry($nick);
            if ($auth) {
                $valid = $auth->checkAuth($nick, $passwd);
                if ($valid) {
                    // If the supplied login info is correct, find or create the game account in the DB and link
                    // it to a panel account if necessary, and connect to it.
                    AccountUtil::connect($db, $serv, $nick, $sess);
                    header('Location: panel.php');
                    exit;
                }
                $logonFailPwd = true;
            } else {
                $logonFailUsr = true;
            }
        }
    } else {
        // If the server param isn't good, either the client's browser
        // f****d up, either we face a bot. Bail out, since we have nothing
        // more productive to do anyway.
        BotHandler::fuckoff();
    }
}