/
claninfo_process.php
61 lines (55 loc) · 1.73 KB
/
claninfo_process.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* 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 = ".USERID.")"
." 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();
}
}
?>