utstats /html/pages/admin/pban.php

Language PHP Lines 75
MD5 Hash 1dfcad5c8b86ad2fefd650aab1e99416 Estimated Cost $1,433 (why?)
Repository https://github.com/graywh/utstats.git View Raw File View Project SPDX
 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
<?php
if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
	
$ban = ($_REQUEST['saction'] == 'ban') ? true : false;

if ($ban) {
	$options['title'] = 'Ban Player';
} else {
	$options['title'] = 'Unban Player';
}
$i = 0;
$options['vars'][$i]['name'] = 'pid';
$options['vars'][$i]['type'] = 'player';
if ($ban) {
	$options['vars'][$i]['whereisbanned'] = 'N';
} else {
	$options['vars'][$i]['whereisbanned'] = 'Y';
}
$options['vars'][$i]['prompt'] = 'Player?';
$options['vars'][$i]['caption'] = 'Player:';
$i++;

$results = adminselect($options);


$pid = $results['pid'];

if ($ban) {
	echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
	<tr>
		<td class="smheading" align="center" colspan="2">Banning Player</td>
	</tr>
	<tr>
		<td class="smheading" align="left">Removing Player Rank:</td>';
	mysql_query("DELETE FROM uts_rank WHERE pid = $pid") or die(mysql_error());
		echo'<td class="grey" align="left">Done</td>
	</tr>
	<tr>
		<td class="smheading" align="left">Updating Player Record:</td>';
	mysql_query("UPDATE uts_pinfo SET banned = 'Y' WHERE id = $pid") or die(mysql_error());
		echo'<td class="grey" align="left">Done</td>
	</tr>
	
	<tr>
		<td class="smheading" align="center" colspan="2">Player Banned - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
	</tr></table>';
} else {
	echo'<table border="0" cellpadding="1" cellspacing="2" width="600">
	<tr>
		<td class="smheading" align="center" colspan="2">Unbanning Player</td>
	</tr>
	<tr>
		<td class="smheading" align="left">Updating Player Record:</td>';
	mysql_query("UPDATE uts_pinfo SET banned = 'N' WHERE id = $pid") or die(mysql_error());
		echo'<td class="grey" align="left">Done</td>
	</tr>
	<tr>
		<td class="smheading" align="left" width="200">Restoring Rankings</td>';
	
	$sql_nrank = "SELECT SUM(gametime) AS time, pid, gid, SUM(rank) AS rank, COUNT(matchid) AS matches FROM uts_player WHERE pid = $pid GROUP BY pid, gid";
	$q_nrank = mysql_query($sql_nrank) or die(mysql_error());
	while ($r_nrank = mysql_fetch_array($q_nrank)) {
	
		mysql_query("INSERT INTO uts_rank SET time = '$r_nrank[time]', pid = $pid, gid = $r_nrank[gid], rank = '$r_nrank[rank]', prevrank = '$r_nrank[rank]', matches = $r_nrank[matches]") or die(mysql_error());
	}
	
		echo'<td class="grey" align="left" width="400">Done</td>
	</tr>	
	<tr>
		<td class="smheading" align="center" colspan="2">Player Unbanned - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
	</tr></table>';
}
	
?>
Back to Top