-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteserver.php
37 lines (32 loc) · 1.29 KB
/
deleteserver.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
<?php
/* BanManagement © 2012, a web interface for the Bukkit plugin BanManager
by James Mortemore of http://www.frostcast.net
is licenced under a Creative Commons
Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales.
Permissions beyond the scope of this licence
may be available at http://creativecommons.org/licenses/by-nc-sa/2.0/uk/.
Additional licence terms at https://raw.github.com/confuser/Ban-Management/master/banmanagement/licence.txt
*/
if(!isset($_SESSION['admin']) || (isset($_SESSION['admin']) && !$_SESSION['admin']))
die('Hacking attempt');
else if(!isset($_GET['authid']) || (isset($_GET['authid']) && $_GET['authid'] != sha1($settings['password'])))
die('Hacking attempt');
else if(!isset($_GET['id']) || !is_numeric($_GET['id']))
die('Hacking attempt');
else if(!isset($settings['servers'][$_GET['id']]))
die('Hacking attempt');
else {
// Success! Remove it
$servers = $settings['servers'];
unset($servers[$_GET['id']]);
$servers = serialize($servers);
$servers = "['servers'] = '".$servers;
$contents = file_get_contents('settings.php');
$contents = preg_replace("/\['servers'\] = '(.*?)/", $servers, $contents);
file_put_contents('settings.php', $contents);
$array['success'] = 'true';
}
if(isset($error))
$array['error'] = $error;
echo json_encode($array);
?>