summaryrefslogtreecommitdiff
path: root/html/pages/report_cb.php
blob: 50eb5d4978c2f2945a2ce1df23d87d18484d87cc (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
echo'<form NAME="report" METHOD="get" ACTION="./?p=report">
	<input type="hidden" name="p" value="report" size="0">
	<input type="hidden" name="rtype" value="clanbase" size="0">
	<input type="hidden" name="id" value="'.$id.'" size="0">
	<input type="hidden" name="stage" value="1" size="0">
  <table CLASS="searchformb">
	<tr>
	  <td class="heading" colspan="2" ALIGN="center" width="480">Enter the Clanbase WarID</td>
	</tr>
	<tr>
	  <td ALIGN="left" class="grey">
	  <input TYPE="text" NAME="wid" MAXLENGTH="20" SIZE="20" value="'.(preg_replace('/\D/', '', $_GET['wid'])).'" CLASS="searchform">
	  <input TYPE="submit" VALUE="Submit" CLASS="searchformb"></td>
	</tr>
  </table>
</form>';

echo'<table>
<tr>
	<td width="480" align="center" class="heading" colspan="2">
	Team BreakDown of Match</td>
</tr>
<tr>
<td width="240" align="center" class="smheading">Red Team</td>
<td width="240" align="center" class="smheading">Blue Team</td>
<tr>
	<td width="50%" class="grey">';

$sql_rteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";
$q_rteam = mysql_query($sql_rteam);
while ($r_rteam = mysql_fetch_array($q_rteam)) {
	echo''.$r_rteam[name].'<br />';
	}
echo'</td>
<td width="50%" class="grey">';

$sql_bteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";
$q_bteam = mysql_query($sql_bteam);
while ($r_bteam = mysql_fetch_array($q_bteam)) {
	echo''.$r_bteam[name].'<br />';
	}
echo'</td></tr></table><br>';

IF ($wid == "") {
}

IF ($stage >= "1") {
   include("includes/clanbase.php");
   $warinfo = get_clans($wid);
}

IF ($stage == "1") {
	$claninfo0 = get_players($warinfo[0][1]);
	$claninfo1 = get_players($warinfo[1][1]);

	echo'<form action="" method="get">
	<input type="hidden" name="p" value="report" size="0">
	<input type="hidden" name="rtype" value="clanbase" size="0">
	<input type="hidden" name="id" value="'.$id.'" size="0">
	<input type="hidden" name="wid" value="'.$wid.'" size="0">
	<input type="hidden" name="stage" value="2" size="0">
	<table class="searchformb">

	<tr>
		<td width="480" align="center" class="heading" colspan="2">
		Who Played As Red Team?</td>
	</tr>
	<tr>
		<td width="100%" class="grey" colspan="2">
		<select size="1" name="red" CLASS="searchform">
		<option value="'.$warinfo[0][1].'">'.$warinfo[0][2].'</option>
		<option value="'.$warinfo[1][1].'">'.$warinfo[1][2].'</option>
		</select>
		<input type=submit CLASS="searchformb" value="Assign"></td>
	</tr>
	</table>
	</form>';
}

IF ($stage == "2") {
	$redteam = $_GET["red"];

	IF($redteam == $warinfo[0][1]) {
		$redcid = $warinfo[0][1];
		$redname = $warinfo[0][2];
		$redinfo = get_players($warinfo[0][1]);
		$bluecid = $warinfo[1][1];
		$bluename = $warinfo[1][2];
		$blueinfo = get_players($warinfo[1][1]);

	} else {
		$redcid = $warinfo[1][1];
		$redname = $warinfo[1][2];
		$redinfo = get_players($warinfo[1][1]);
		$bluecid = $warinfo[0][1];
		$bluename = $warinfo[0][2];
		$blueinfo = get_players($warinfo[0][1]);
	}

	echo'<form action="" method="get">
			<input type="hidden" name="p" value="report" size="0">
			<input type="hidden" name="rtype" value="clanbase" size="0">
			<input type="hidden" name="stage" value="generate" size="0">
			<input type="hidden" name="id" value="'.$id.'" size="0">
			<input type="hidden" name="wid" value="'.$wid.'" size="0">
			<input type="hidden" name="red" value="'.htmlspecialchars($redteam, ENT_QUOTES).'" size="0">
			<table class="searchformb">
			<tr>
				<td width="480" colspan="2" align="center" class="heading">
				Clan and Player Info for Clanbase War ID '.$wid.'</td>
			</tr>
			<tr>
				<td colspan="2" align="center" class="smheading">
				<a href="http://www.clanbase.com/claninfo.php?cid='.$redcid.'" target="_blank">'.$redname.'</a></td>
			</tr>';

			$redcount = count($redinfo);
			$bluecount = count($blueinfo);

			$sql_rteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 0 ORDER BY pi.name ASC";

			$q_rteam = mysql_query($sql_rteam);
			while($r_rteam = mysql_fetch_array($q_rteam)) {

			echo'<tr>
				<td class="grey">'.$r_rteam[name].'</td>
				<td class="grey">
				<select CLASS="searchform" name="'.$r_rteam[id].'">
				<option selected CLASS="searchform" value="">Use Me To Assign a CB Player to Stats</option>';

			for ($i = 0; $i < $redcount; $i++) {
					echo'<option CLASS="searchform" value="'.$redinfo[$i][0].'">'.$redinfo[$i][1].'</option>';
				}
				echo'</select></td>
				</tr>';
		}

			echo'<td width="100%" align="center" class="smheading" colspan="2">
				<a href="http://www.clanbase.com/claninfo.php?cid='.$bluecid.'" target="_blank">'.$bluename.'</a></td>';


			$sql_bteam = "SELECT p.id, pi.name FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $id AND team = 1 ORDER BY pi.name ASC";

			$q_bteam = mysql_query($sql_bteam);
			while($r_bteam = mysql_fetch_array($q_bteam)) {

			echo'<tr>
				<td class="grey">'.$r_bteam[name].'</td>
				<td class="grey">
				<select CLASS="searchform" name="'.$r_bteam[id].'">
				<option selected CLASS="searchform" value="">Use Me To Assign a CB Player to Stats</option>';

			for ($i = 0; $i < $bluecount; $i++) {
					echo'<option CLASS="searchform" value="'.$blueinfo[$i][0].'">'.$blueinfo[$i][1].'</option>';
				}
				echo'</select></td>
				</tr>';
		}

	echo'<tr>
		<td class="grey" colspan="2" align="center">
		<input type=submit CLASS="searchformb" value="Generate Report">
		</td>
	</tr>
	</table></form>';
}
?>