Example #1
0
* ClanInfo_process.php
*
*/
require_once e_PLUGIN . 'ebattles/include/clan.php';
require_once e_PLUGIN . 'ebattles/include/event.php';
if (isset($_POST['joindivision'])) {
    $div_id = $_POST['division'];
    $division = new Division($div_id);
    $q = "SELECT " . TBL_CLANS . ".*, " . TBL_DIVISIONS . ".*" . " FROM " . TBL_CLANS . ", " . TBL_DIVISIONS . " WHERE (" . TBL_DIVISIONS . ".DivisionID = '{$div_id}')" . " AND (" . TBL_DIVISIONS . ".Clan = " . TBL_CLANS . ".ClanID)";
    $result = $sql->db_Query($q);
    $clan_password = mysql_result($result, 0, TBL_CLANS . ".password");
    $gid = mysql_result($result, 0, TBL_DIVISIONS . ".Game");
    if ($clan_password == "" || $_POST['joindivisionPassword'] == $clan_password) {
        $Name = $_POST["gamername"];
        $UniqueGameID = $_POST["gameruniquegameid"];
        $gamerID = updateGamer(USERID, $gid, $Name, $UniqueGameID);
        $division->addMember(USERID, FALSE);
    }
}
if (isset($_POST['quitdivision'])) {
    $div_id = $_POST['division'];
    $division = new Division($div_id);
    // Check that the member has made no games with this division
    $q_MemberScores = "SELECT " . TBL_MEMBERS . ".*, " . TBL_TEAMS . ".*, " . TBL_PLAYERS . ".*, " . TBL_SCORES . ".*" . " FROM " . TBL_MEMBERS . ", " . TBL_TEAMS . ", " . TBL_PLAYERS . ", " . TBL_SCORES . " WHERE (" . TBL_MEMBERS . ".User = "******")" . " AND (" . TBL_MEMBERS . ".Division = '{$div_id}')" . " AND (" . TBL_TEAMS . ".Division = '{$div_id}')" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)" . " AND (" . TBL_SCORES . ".Player = " . TBL_PLAYERS . ".PlayerID)";
    $result_MemberScores = $sql->db_Query($q_MemberScores);
    $numMemberScores = mysql_numrows($result_MemberScores);
    if ($numMemberScores == 0) {
        $division->deleteMemberPlayers();
        $division->deleteMember();
    }
}
Example #2
0
if (isset($_POST['kick'])) {
    //fm: Not good
    // We can not delete members w/o deleting the corresponding players.
    // And we can delete players only if they have not scored yet.
    // Therefore, we can only delete members if they have not played in a match yet.
    $clan_div = $_POST['clandiv'];
    $division = new Division($clan_div);
    $game_id = $division->getField('Game');
    if (count($_POST['del']) > 0) {
        $del_ids = $_POST['del'];
        for ($i = 0; $i < count($del_ids); $i++) {
            $q2 = "DELETE FROM " . TBL_MEMBERS . " WHERE (" . TBL_MEMBERS . ".MemberID = '{$del_ids[$i]}')";
            $result2 = $sql->db_Query($q2);
        }
    }
    //echo "-- kick --<br />";
    header("Location: clanmanage.php?clanid={$clan_id}&amp;gameid={$game_id}");
    exit;
}
if (isset($_POST['claninviteuser'])) {
    $user = $_POST['user'];
    $clan_div = $_POST['clandiv'];
    $division = new Division($clan_div);
    $game_id = $division->getField('Game');
    $division->addMember($user, TRUE);
    //echo "-- claninviteuser --<br />";
    header("Location: clanmanage.php?clanid={$clan_id}&amp;gameid={$game_id}");
    exit;
}
header("Location: clanmanage.php?clanid={$clan_id}");
exit;