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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<script language="JavaScript1.2" type="text/javascript">
function checkick(Id,Sid,Nick){
	Check = confirm("Would you like Kick"+Nick+"?");
	if(Check == true){
		setTimeout("window.location.href='?p=show&kick="+Id+"&id="+Sid+"'",0);
	}
}
function checkban(Id,Sid,Nick){
	if(Nick != ""){
		Check = confirm("Would you like Ban"+Nick+"?");
	}else{
		Check = confirm("Would you like IP "+Id+"?");
	}
	if(Check == true){
		setTimeout("window.location.href='?p=show&banip="+Id+"&id="+Sid+"'",0);
	}
}
function checkbanusgn(Id,Sid){
	Check = confirm("Would you like Ban USGN #"+Id+"?");
	if(Check == true){
		setTimeout("window.location.href='?p=show&banusgn="+Id+"&id="+Sid+"'",0);
	}
}
</script>
<?php
if($_GET['kick']!=""){
	send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"kick ".$_GET['kick']);
}
if($_GET['banip']!=""){
	send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"banip ".$_GET['banip']);
}
if($_GET['banusgn']!=""){
	send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"banusgn ".$_GET['banusgn']);
}
if($_GET['ban2']!=""){
	$banip=$_POST['ip'];
	$banus=$_POST['us'];
	if($banus!=""){
		send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"banusgn ".$_POST['us']);
	}
	if($banip!=""){
		send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"banip ".$_POST['ip']);
	}
}
if($_POST['ban']!="" or $_GET['ban']!=""){
	$bans=$_POST['ban'];
	if($bans==""){$bans=$_GET['ban'];}
	send_command("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],"unban ".$bans);
	echo "<b>Player unbaned!</b><br>";
}
$sid = $_GET['id'];
if (isset($_SESSION['curserv'])){
	unset($_SESSION['curserv']);
}
if (checkserver($sid)){
	$_uid = $_SESSION['uid'];
	$result = mysql_query("SELECT * FROM `server` WHERE `uid` = '$_uid' AND `id` = '$sid'");
	while ($row = mysql_fetch_object($result)){
		$server['id'] = $row->uid;
		$server['name'] = $row->name;
		$server['port'] = $row->port;
		$server['maxpl'] = $row->maxpl;
		$server['dir'] = $row->dir;
		$server['rcon'] = $row->rcon;
	}
	$_SESSION['curserv'] = $server;
	echo '<meta http-equiv="refresh" content="60; URL=?p=show&id='.$sid.'">';
?>
Chosen Server:
<br/>
<table border=0 cellpadding="3">
<tr><td><b>Name:</b></td><td> <?php echo $server['name']; ?> </tr>
<tr><td><b>Port:</b></td><td> <?php echo $server['port']; ?> </tr>
<tr><td><b>MaxPlayers:</b></td><td> <?php echo $server['maxpl']; ?> </tr>
<tr><td><b>Status:</b></td><td> <?php server_status("localhost",$server['port']); }?></tr></table>
<?php $playerlist=send_command_rtn("localhost",$_SESSION['curserv']['port'],$_SESSION['curserv']['rcon'],'listplayers');
	$players="";
	if(strlen($playerlist)!=0)
	{
		if(strlen($playerlist)!=7){
			$fon=false;
			echo '<b>Players:</b>';
			if(strlen($playerlist)==34)
			{
				//echo "Nobody is playing on this Server.";
				$fon=1;
			}else{
				$chararray=str_split($playerlist,1);
				$blah=33;
				$lenge=$blah+ord($chararray[$blah+4]);
				for($count=0;$count < strlen($playerlist);$count++)
				{
					if($count > $blah+15)
					{
						if($count < $lenge+6)
						{
							$players=$players.$chararray[$count];
						}else{
							$players=$players."/n";
							$blah=$lenge+5;
							$lenge=$blah+ord($chararray[$blah+4]);
						}
					}
				}
			}
		
		
			$array=split("/n", $players);
			//sort($array);
			$counts=count($array);
			echo "<b>".$counts."</b><br>";
			echo '<table border=0 width="100%" cellpadding="1">
			<tr bgcolor="#c7c7c7"><td style="border: solid 1px black;"><b>#</b></td><td style="border: solid 1px black;"><b>Nickname</b></td><td style="border: solid 1px black;"><b>IP Adress</b></td><td style="border: solid 1px black;"><b>#USGN</b></td><td style="border: solid 1px black;"><b>Team</b></td>';	
			if($fon==0){
				for($i=0;$i<$counts;$i++)
				{
					echo '<tr ';if($teslo==1){echo'bgcolor="#dfdfdf"';$teslo=0;}else{$teslo=1;}echo'>';
					$array2=split(",", $array[$i]);
					$array2[2]=str_replace("IP ", "", $array2[2]);
					$array2[0]=str_replace("# ", "", $array2[0]);
					$ip2=split(":", $array2[2]);
					echo '<td style="border: solid 1px black"># '.$array2[0].'</td>';
					echo '<td style="border: solid 1px black"><a style="text-decoration:underline;color:black;" href="javascript:checkick('.$array2[0].','.$sid.',\''.$array2[1].'\');">'.$array2[1].'</a></td>';
					echo '<td style="border: solid 1px black"><a style="text-decoration:underline;color:black;" href="javascript:checkban(\''.$ip2[0].'\','.$sid.',\''.$array2[1].'\');">'.$array2[2].'</a></td>';
		
					if(count($array2)==4){ //ohne USGN
						echo '<td style="border: solid 1px black;"></td>';		 //usgn
						echo '<td style="border: solid 1px black;">'.$array2[3].'</td>'; //team
					}else{
						$array2[3]=str_replace("USGN #", "", $array2[3]);
						echo '<td style="border: solid 1px black"><a style="text-decoration:underline;color:black;" href="javascript:checkbanusgn('.$array2[3].','.$sid.',\''.$array2[1].'\');">#'.$array2[3].'</td>';
						echo '<td style="border: solid 1px black;">'.$array2[4].'</td>';
					}
					echo "</tr>";
				}
			}else{
				echo '<tr cellpadding="4">Nobody is playing on this Server.</tr>';
			}
			echo '</table>';
			echo '<table><form action="?p=show&id='.$sid.'&ban2=1" method="POST">';
			?>
			<tr><td>Ban IP:</td><td><input type="text" name="ip" size="25" value=""></td></tr>
			<tr><td>Ban USGN:</td><td><input type="text" name="us" size="25" value=""></td></tr>
			<tr><td></td><td><input type="submit" value="Ban"></td></tr>
			</form><br>
			<?
			echo '<table border=0 width="100%" cellpadding="1">
				<tr bgcolor="#c7c7c7"><td style="border: solid 1px black;"><b>Type</b></td><td style="border: solid 1px black;"><b>IP/USGN</b></td><td style="border: solid 1px black;"><b>Delete</b></td>';
			$lines = file ($_SESSION['curserv']['dir']."sys/bans.lst");
			$teslo=false;
			foreach ($lines as $line_num => $line2) {
				$line2=str_replace("	","",$line2);
				$a=str_split(htmlspecialchars($line2));
				//banip
				$nwstr=$a[0].$a[1].$a[2].$a[3].$a[4];
				$nwstr2=$a[0].$a[1].$a[2].$a[3].$a[4].$a[5].$a[6];
				if($nwstr=="banip"){
					$lt=count($a);
					for($i=5;$i < $lt;$i++)
					{
						$tip=$tip.$a[$i];
					}
					echo '<tr ';if($teslo==1){echo'bgcolor="#dfdfdf"';$teslo=0;}else{$teslo=1;}echo'>';
					echo '<td style="border: solid 1px black;">IP</td>';
					echo '<td style="border: solid 1px black;">'.$tip,'</td><td width=70 style="border: solid 1px black;text-decoration:underline; color:black;" ><a style="text-decoration:underline;color:black;" href="?p=show&id='.$sid.'&ban='.$tip.'">Delete</a></td></tr>';
					$tip="";
				}elseif($nwstr2=="banusgn"){
					$lt=count($a);
					for($i=7;$i < $lt;$i++)
					{
						$us=$us.$a[$i];
					}
					echo '<tr ';if($teslo==1){echo'bgcolor="#dfdfdf"';$teslo=0;}else{$teslo=1;}echo'>';
					echo '<td width=50 style="border: solid 1px black;">USGN</td>';
					echo '<td style="border: solid 1px black;">'.$us,'</td><td style="border: solid 1px black;text-decoration:underline; color:black;" ><a style="text-decoration:underline;color:black;" href="?p=show&id='.$sid.'&ban='.$us.'">Delete</a></td></tr>';
					$us="";
				}
			}
			fclose($lines);
			?> </table><?
		}else{
			echo "Error: Remote connection failed.";
		}
	}
	
	
	
?>