コード例 #1
0
ファイル: register.php プロジェクト: szakats/bzflag_mirror
function section_register()
{
    $se = new FormEdit();
    $se->trimAll();
    $se->stripAll();
    // meno 2007/05/01 ....
    if (PRIVATE_LEAGUE != 0) {
        return errorPage('Nuh uh, no reg for you');
    }
    $headers = apache_request_headers();
    $fromIP = $_SERVER['REMOTE_ADDR'];
    $fd = fopen(PROXY_LOG, 'a');
    fwrite($fd, "\n----------------------- " . date('r') . " --------------------\n");
    fwrite($fd, "*** FROM IP: {$_SERVER['REMOTE_ADDR']}\n");
    foreach ($headers as $n => $v) {
        fwrite($fd, "{$n}: {$v}\n");
    }
    foreach ($headers as $header => $value) {
        if (strncmp($fromIP, '172', 3) == 0 || strcasecmp($header, 'X-Forwarded-For') == 0 || strcasecmp($header, 'Via') == 0) {
            fwrite($fd, "************************* PROXY DETECT ***********************\n");
            fclose($fd);
            return errorPage("We're sorry, currently we cannot accept new registrations from AOL users, or users connecting through a proxy.");
        }
    }
    fclose($fd);
    if ($_SESSION['callsign']) {
        return errorPage('You are already registered with the league system.');
    }
    if ($se->SUB) {
        section_register_validate($se);
        if (!$se->isError()) {
            section_register_doSubmit($se);
            return;
        }
    }
    section_register_presentEditForm($se);
}
コード例 #2
0
ファイル: playerinfo.php プロジェクト: szakats/bzflag_mirror
function section_playerinfo()
{
    $editAny = isFuncAllowed('edit_any_players');
    $se = new FormEdit();
    $se->trimAll();
    $se->stripAll();
    if (!$se->checkRequired(array('id', 'link'))) {
        return errorPage('missing argument');
    }
    echo '<BR>';
    $query = "select P.id, P.callsign, P.status, P.comment, \n      P.logo, T.name as teamname, T.id teamid, T.leader, r.name as level,\n      C.flagname, C.name as countryname, C.numcode as country,\n      P.state, S.abbrev as stateabbr, P.logobg,\n      P.email, P.emailpub, P.aim, P.altnik1, P.altnik2,\n      P.ircnik1, P.emailpub, P.utczone, P.zonename, P.icq, P.city,\n      P.yim, P.msm, P.jabber, P.md5password, \n      unix_timestamp(P.created) as created, \n      unix_timestamp(P.last_login) as last_login,\n      r.id as role_id\n      from (l_player P, bzl_roles r )\n      left join l_team T on P.team = T.id\n      left join bzl_countries C on P.country = C.numcode\n      left join bzl_states S on P.state = S.id\n      where P.id = '{$se->id}'\n      and r.id = P.role_id \n      ";
    $se->setDataRow(mysql_fetch_assoc(sqlQuery($query)));
    if ($se->f_cancel_x) {
        $se->link = "playerinfo";
    }
    if ($se->link == 'playeradmin') {
        // present edit form
        // security check ...
        if ($se->id != $_SESSION['playerid'] && !$editAny) {
            errorPage('You are not authorized to edit this profile.');
            section_playerinfo_displayPlayer($se);
            return;
        }
        if ($se->f_ok_x) {
            section_playerinfo_validate($se);
            if (!$se->isError()) {
                section_playerinfo_doSubmit($se);
                $se->setNextState(FESTATE_INITIAL);
                $se->setDataRow(mysql_fetch_assoc(sqlQuery($query)));
                section_playerinfo_displayPlayer($se);
                return;
            }
        }
        $se->setNextState(FESTATE_SUBMIT);
        section_playerinfo_presentEditForm($se);
    } else {
        section_playerinfo_displayPlayer($se);
    }
}