コード例 #1
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);
    }
}