コード例 #1
0
ファイル: guilds.php プロジェクト: s3kk/Gesior
 $player_n = stripslashes($_REQUEST['name']);
 $new_nick = stripslashes($_REQUEST['nick']);
 $player = new OTS_Player();
 $player->find($player_n);
 $player_from_account = FALSE;
 if (strlen($new_nick) <= 40) {
     if ($player->isLoaded()) {
         $account_players = $account_logged->getPlayersList();
         if (count($account_players)) {
             foreach ($account_players as $acc_player) {
                 if ($acc_player->getId() == $player->getId()) {
                     $player_from_account = TRUE;
                 }
             }
             if ($player_from_account) {
                 $player->setGuildNick($new_nick);
                 $player->save();
                 $main_content .= 'Guild nick of player <b>' . $player->getName() . '</b> changed to <b>' . htmlentities($new_nick) . '</b>.';
                 $addtolink = '&action=show&guild=' . $player->getRank()->getGuild()->getId();
             } else {
                 $main_content .= 'This player is not from your account.';
             }
         } else {
             $main_content .= 'This player is not from your account.';
         }
     } else {
         $main_content .= 'Unknow error occured.';
     }
 } else {
     $main_content .= 'Too long guild nick. Max. 30 chars, your: ' . strlen($new_nick);
 }