<ul class="unstyled"> <li><font class="profile_font" name="profile_font_level">Sex:<?php if ($profile_data['sex'] == 1) { echo 'Male'; } else { echo 'Female'; } ?> </font></li> <li><font class="profile_font" name="profile_font_level">Level: <?php echo $profile_data['level']; ?> </font></li> <li><font class="profile_font" name="profile_font_vocation">Vocation: <?php echo vocation_id_to_name($profile_data['vocation']); ?> </font></li> <?php if ($guild_exist) { ?> <li><font class="profile_font" name="profile_font_vocation"><b><?php echo $guild['rank_name']; ?> </b> of <a href="guilds.php?name=<?php echo $guild_name; ?> "><?php echo $guild_name; ?> </a></font></li>
function user_character_list($account_id) { //$count = user_character_list_count($account_id); $account_id = (int) $account_id; if (config('TFSVersion') == 'TFS_10') { $characters = mysql_select_multi("SELECT `id`, `name`, `level`, `vocation`, `town_id`, `lastlogin` FROM `players` WHERE `account_id`='{$account_id}' ORDER BY `level` DESC"); if ($characters !== false) { $onlineArray = mysql_select_multi("SELECT `player_id` FROM `players_online`;"); $onlineIds = array(); if ($onlineArray !== false) { foreach ($onlineArray as $row) { $onlineIds[] = $row['player_id']; } } for ($i = 0; $i < count($characters); $i++) { $online = in_array($characters[$i]['id'], $onlineIds); if ($online) { $characters[$i]['online'] = 1; } else { $characters[$i]['online'] = 0; } unset($characters[$i]['id']); } } } else { $characters = mysql_select_multi("SELECT `name`, `level`, `vocation`, `town_id`, `lastlogin`, `online` FROM `players` WHERE `account_id`='{$account_id}' ORDER BY `level` DESC"); } if ($characters !== false) { $count = count($characters); for ($i = 0; $i < $count; $i++) { $characters[$i]['vocation'] = vocation_id_to_name($characters[$i]['vocation']); // Change vocation id to vocation name $characters[$i]['town_id'] = town_id_to_name($characters[$i]['town_id']); // Change town id to town name // Make lastlogin human read-able. if ($characters[$i]['lastlogin'] != 0) { $characters[$i]['lastlogin'] = getClock($characters[$i]['lastlogin'], true, false); } else { $characters[$i]['lastlogin'] = '******'; } $characters[$i]['online'] = online_id_to_name($characters[$i]['online']); // 0 to "offline", 1 to "ONLINE". } } return $characters; }
<td><?php echo $i + 1; ?> </td> <td><?php echo '<img src="\\flags\\' . $account_data['flag'] . '.png"> '; ?> <a href="characterprofile.php?name=<?php echo $scores[$type][$i]['name']; ?> "><?php echo $scores[$type][$i]['name']; ?> </a></td> <td><?php echo vocation_id_to_name($scores[$type][$i]['vocation']); ?> </td> <td><?php echo $scores[$type][$i]['value']; ?> </td> <?php if ($type === 7) { echo "<td>" . $scores[$type][$i]['experience'] . "</td>"; } ?> </tr> <?php } }
<li> Name:<br> <input type="text" name="name"> </li> <li> <!-- Available vocations to select from when creating character --> Vocation:<br> <select name="selected_vocation"> <?php foreach ($config['available_vocations'] as $id) { ?> <option value="<?php echo $id; ?> "><?php echo vocation_id_to_name($id); ?> </option> <?php } ?> </select> </li> <li> <!-- Available genders to select from when creating character --> Gender:<br> <select name="selected_gender"> <option value="1">Male(boy)</option> <option value="0">Female(girl)</option> </select> </li>
<br> <span style="font-size:85%"><?php $post_name = sanitize($post['player_name']); $post_data = mysql_select_single("SELECT `name`, `group_id`, `vocation`, `level` FROM `players` WHERE `name` = '{$post_name}' ;"); if ($post_data['group_id'] > 1) { foreach ($config['ingame_positions'] as $key => $value) { if ($key == $post_data['group_id']) { echo $value; echo '<br>'; } } } ?> <br> Vocation: <?php echo vocation_id_to_name($post_data['vocation']); ?> <br> Level: <?php echo $post_data['level']; ?> <br><br></span> </td> <td valign="top"> <p><?php echo nl2br(TransformToBBCode($post['text'])); ?> </p> </td> </tr>
?> <table id="onlinelistTable" class="table table-striped table-hover"> <tr class="yellow"> <th>Name:</th> <th>Guild:</th> <th>Level:</th> <th>Vocation:</th> </tr> <?php foreach ($array as $value) { $url = url("characterprofile.php?name=" . $value['name']); echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; echo '<td><a href="characterprofile.php?name=' . $value['name'] . '">' . $value['name'] . '</a></td>'; if (!empty($value['gname'])) { echo '<td><a href="guilds.php?name=' . $value['gname'] . '">' . $value['gname'] . '</a></td>'; } else { echo '<td></td>'; } echo '<td>' . $value['level'] . '</td>'; echo '<td>' . vocation_id_to_name($value['vocation']) . '</td>'; echo '</tr>'; } ?> </table> <?php } else { echo 'Nobody is online.'; } include 'layout/overall/footer.php';
/** * Create player. * * @param none * @access public * @return bool $status **/ public function create() { // If player already have an id, the player already exist. if (is_null($this->_playerdata['id']) && is_string($this->_playerdata['name'])) { // Confirm player does not exist $name = format_character_name($this->_playerdata['name']); $name = validate_name($name); $name = sanitize($name); $exist = mysql_select_single("SELECT `id` FROM `players` WHERE `name`='{$name}' LIMIT 1;"); if ($exist !== false) { $this->errors[] = "A player with the name [{$name}] already exist."; return false; } $config = fullConfig(); if (user_character_exist($_POST['name']) !== false) { $errors[] = 'Sorry, that character name already exist.'; } if (!preg_match("/^[a-zA-Z_ ]+\$/", $_POST['name'])) { $errors[] = 'Your name may only contain a-z, A-Z and spaces.'; } if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) { $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.'; } // name restriction $resname = explode(" ", $_POST['name']); foreach ($resname as $res) { if (in_array(strtolower($res), $config['invalidNameTags'])) { $errors[] = 'Your username contains a restricted word.'; } else { if (strlen($res) == 1) { $errors[] = 'Too short words in your name.'; } } } // Validate vocation id if (!in_array((int) $_POST['selected_vocation'], $config['available_vocations'])) { $errors[] = 'Permission Denied. Wrong vocation.'; } // Validate town id if (!in_array((int) $_POST['selected_town'], $config['available_towns'])) { $errors[] = 'Permission Denied. Wrong town.'; } // Validate gender id if (!in_array((int) $_POST['selected_gender'], array(0, 1))) { $errors[] = 'Permission Denied. Wrong gender.'; } if (vocation_id_to_name($_POST['selected_vocation']) === false) { $errors[] = 'Failed to recognize that vocation, does it exist?'; } if (town_id_to_name($_POST['selected_town']) === false) { $errors[] = 'Failed to recognize that town, does it exist?'; } if (gender_exist($_POST['selected_gender']) === false) { $errors[] = 'Failed to recognize that gender, does it exist?'; } // Char count $char_count = user_character_list_count($session_user_id); if ($char_count >= $config['max_characters']) { $errors[] = 'Your account is not allowed to have more than ' . $config['max_characters'] . ' characters.'; } if (validate_ip(getIP()) === false && $config['validate_IP'] === true) { $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).'; } echo "create player"; // Make sure all neccesary values are set //Register $character_data = array('name' => format_character_name($_POST['name']), 'account_id' => $session_user_id, 'vocation' => $_POST['selected_vocation'], 'town_id' => $_POST['selected_town'], 'sex' => $_POST['selected_gender'], 'lastip' => ip2long(getIP()), 'created' => time()); array_walk($character_data, 'array_sanitize'); $cnf = fullConfig(); if ($character_data['sex'] == 1) { $outfit_type = $cnf['maleOutfitId']; } else { $outfit_type = $cnf['femaleOutfitId']; } // Create the player } else { echo "Player already exist."; return false; } }
} if (empty($type)) { $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT ' . $limit); } elseif ($type >= 1 && $type <= 3) { $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int) $type . '` DESC LIMIT ' . $limit); } echo '<CENTER><H2>Ranking of powergamers</H2></CENTER> <BR> <table class="table table-striped"> <td><center><b>#</b></center></td> <td><b>Name</b></td>'; echo '<td><center>Total</center></td>'; for ($i = 3; $i >= 2; $i--) { echo $type == $i ? '<TD id="selectedP" width="16%"><a href="powergamers.php?type=' . $i . '">' . $i . '<b> Days Ago</b></a></B></TD>' : '<TD width="16%"><center><a href="powergamers.php?type=' . $i . '">' . $i . ' Days Ago</a></TD>'; } echo $type == 1 ? '<TD id="selectedP" width="16%"><b><a href="powergamers.php?type=1">1 Day Ago</a></B></TD>' : '<TD width="16%"><a href="powergamers.php?type=1">1 Day Ago</a></TD>'; echo empty($type) ? '<TD id="selectedP"><b><a href="powergamers.php">Today</a></b></TD>' : '<TD><a href="powergamers.php">Today</a></TD>'; echo '</TR>'; $number_of_rows = 1; if ($znotePlayers) { foreach ($znotePlayers as $player) { echo '<td><center>' . $number_of_rows . '.</center></td>'; echo '<td><a href="characterprofile.php?name=' . $player['name'] . '">' . $player['name'] . '</a>'; echo '<br> ' . $player['level'] . ' ' . htmlspecialchars(vocation_id_to_name($player['vocation'])) . ' '; echo '<td><center>' . coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['experience'] - $player['exphist_lastexp']) . '</center></td>'; echo '<td><center>' . coloured_value($player['exphist3']) . '</center></td><td><center>' . coloured_value($player['exphist2']) . '</center></td><td><center>' . coloured_value($player['exphist1']) . '</center></td><td><center>' . coloured_value($player['experience'] - $player['exphist_lastexp']) . '</center></td></tr>'; $number_of_rows++; } } echo '</table><br></div>'; include 'layout/overall/footer.php';