function guild_player_join($cid, $gid) { $cid = (int) $cid; $gid = (int) $gid; // Create a status we can return depending on results. $status = false; if (config('TFSVersion') !== 'TFS_10') { // Get rank data $ranks = get_guild_rank_data($gid); // Locate rank id for regular member position in this guild $rid = false; foreach ($ranks as $rank) { if ($rank['level'] == 1) { $rid = $rank['id']; } } // Add to guild if rank id was found: if ($rid != false) { // Remove the invite: guild_remove_invitation($cid, $gid); // Add to guild: mysql_update("UPDATE `players` SET `rank_id`='{$rid}' WHERE `id`={$cid}"); $status = true; } } else { // Find rank id for regular member in this guild $guildrank = mysql_select_single("SELECT `id` FROM `guild_ranks` WHERE `guild_id`='{$gid}' AND `level`='1' LIMIT 1;"); if ($guildrank !== false) { $rid = $guildrank['id']; // Remove invite guild_remove_invitation($cid, $gid); // Add to guild mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('{$cid}', '{$gid}', '{$rid}', '');"); // Return success return true; } return false; } return $status; }
echo '</tr>'; } } ?> </table> <?php } ?> <!-- Leader stuff --> <?php // Only guild leaders if (user_logged_in() === true) { // Uninvite and joinguild is also used for visitors who reject their invitation. if (!empty($_POST['uninvite'])) { // guild_remove_invitation($_POST['uninvite'], $gid); header('Location: guilds.php?name=' . $_GET['name']); exit; } if (!empty($_POST['joinguild'])) { // foreach ($inv_data as $inv) { if ($inv['player_id'] == $_POST['joinguild']) { if ($config['TFSVersion'] !== 'TFS_10') { $chardata = user_character_data($_POST['joinguild'], 'online'); } else { $chardata['online'] = user_is_online_10($_POST['joinguild']) ? 1 : 0; } if ($chardata['online'] == 0) { if (guild_player_join($_POST['joinguild'], $gid)) { header('Location: guilds.php?name=' . $_GET['name']);