Guilds: You can not invite a player to your guild if he is already in a guild. Fix #136

This commit is contained in:
Stefan Brannfjell 2014-06-17 18:08:05 +02:00
parent d3807bfafe
commit d7adcd1990

View File

@ -369,6 +369,18 @@ if ($highest_access >= 2) {
}
if (!empty($_POST['invite'])) {
if (user_character_exist($_POST['invite'])) {
// Make sure they are not in another guild
if ($config['TFSVersion'] != 'TFS_10') {
$charname = sanitize($_POST['invite']);
$playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;");
$charid = $playerdata['id'];
$membership = ($playerdata['rank_id'] > 0) ? true : false;
} else {
$charid = user_character_id($_POST['invite']);
$membership = mysql_select_single("SELECT `rank_id` FROM `guild_membership` WHERE `player_id`='$charid' LIMIT 1;");
}
if (!$membership) {
//
$status = false;
if ($inv_data !== false) {
@ -381,10 +393,12 @@ if ($highest_access >= 2) {
}
if ($status == false) {
guild_invite_player(user_character_id($_POST['invite']), $gid);
guild_invite_player($charid, $gid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
} else echo '<font color="red" size="4">That character is already invited(or a member) on this guild.</font>';
} else echo '<font color="red" size="4">That character is already in a guild.</font>';
} else echo '<font color="red" size="4">That character name does not exist.</font>';
}
// Guild Message (motd)