utstats /html/pages/admin/emptydb.php

Language PHP Lines 62
MD5 Hash 9a4f31d36addbac0ad235b43084138cc Estimated Cost $1,236 (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
<?php
if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');

$options['title'] = 'Empty the Database';
$i = 0;
$options['vars'][$i]['name'] = 'sure';
$options['vars'][$i]['type'] = 'static';
$options['vars'][$i]['options'] = 'No|Yes';
$options['vars'][$i]['exitif'] = 'No';
$options['vars'][$i]['prompt'] = 'Are you sure (all data will be lost)?';
$options['vars'][$i]['caption'] = 'Sure:';
$i++;
$options['vars'][$i]['name'] = 'really';
$options['vars'][$i]['type'] = 'static';
$options['vars'][$i]['options'] = 'No|Yes';
$options['vars'][$i]['exitif'] = 'No';
$options['vars'][$i]['prompt'] = 'Are you really sure (this can NOT be undone)?';
$options['vars'][$i]['caption'] = 'Really sure (last warning):';
$i++;

$results = adminselect($options);


IF ($results['sure'] == "Yes" and $results['really'] == "Yes") {
	echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
	<tr>
		<td class="smheading" align="center" colspan="2">Empty Database</td>
	</tr>
	<tr>
		<td class="smheading" align="left" width="300">Emptying All Tables but uts_ip2country and uts_weaponstats</td>';
	mysql_query("TRUNCATE uts_games;") or die(mysql_error());
	mysql_query("TRUNCATE uts_gamestype;") or die(mysql_error());
	mysql_query("TRUNCATE uts_killsmatrix;") or die(mysql_error());
	mysql_query("TRUNCATE uts_match;") or die(mysql_error());
	mysql_query("TRUNCATE uts_pinfo;") or die(mysql_error());
	mysql_query("TRUNCATE uts_player;") or die(mysql_error());
	mysql_query("TRUNCATE uts_rank;") or die(mysql_error());
	mysql_query("DELETE FROM uts_weapons WHERE id > 19") or die(mysql_error());
	mysql_query("ALTER TABLE uts_weapons AUTO_INCREMENT=20") or die(mysql_error());
	mysql_query("TRUNCATE uts_weaponstats;") or die(mysql_error());
		echo'<td class="grey" align="left" width="300">Done</td>
	</tr>
	<tr>
		<td class="smheading" align="center" colspan="2">Database Emptied - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
	</tr></table>';
} else {
	echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
	<tr>
		<td class="smheading" align="center" colspan="2">Empty Database</td>
	</tr>
	<tr>
		<td class="smheading" align="left" width="300">Database Not Emptied</td>
		<td class="grey" align="left" width="300">Answer Was No</td>
	</tr>
	<tr>
		<td class="smheading" align="center" colspan="2">Database Not Emptied - <a href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
	</tr></table>';
}


?>
Back to Top