-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
99 lines (84 loc) · 2.8 KB
/
index.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
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
<?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
*/
define('INTERNAL', true);
session_name("BanManagement");
session_start();
ob_start();
error_reporting(0); // Disable error reports for security
if(!isset($_SESSION['initiated'])) {
session_regenerate_id();
$_SESSION['initiated'] = true;
}
define('IN_PATH', realpath('.') . '/'); // This allows us to use absolute urls
require_once('includes/compat.php');
require_once('includes/utilities.php');
require_once('includes/cache.php');
function connect($server) {
global $settings;
if(!mysql_connect($server['host'], $server['username'], $server['password']))
return false;
else if(!mysql_select_db($server['database']))
return false;
$settings['last_connection'] = $server;
if(isset($settings['utf8']) && $settings['utf8'])
mysql_query("SET NAMES 'utf8'");
return true;
}
require_once('includes/searchBy.php');
$actions = array(
'addserver',
'admin',
'deleteban',
'deletebanrecord',
'deletecache',
'deleteipban',
'deleteipbanrecord',
'deletekickrecord',
'deletemute',
'deletemuterecord',
'deleteserver',
'deletewarning',
'editserver',
'logout',
'reorderserver',
'searchplayer',
'searchip',
'servers',
'updateban',
'updateipban',
'updatemute',
'updatesettings',
'viewip',
'viewplayer'
);
if(file_exists('settings.php')){
include('settings.php');
}
else{
errors('Unable to located the settings.php file. If you haven\'t renamed settingsRename.php yet, please go do that now to make Ban Management functional.');
die();
}
// IE8 frame busting, well thats the only good thing it has :P (Now supported by Firefox woot)
if((isset($settings['iframe_protection']) && $settings['iframe_protection']) || !isset($settings['iframe_protection']))
header('X-FRAME-OPTIONS: SAMEORIGIN');
$settings['servers'] = unserialize($settings['servers']);
// Check if APC is enabled to use that instead of file cache
$settings['apc_enabled'] = $apc_status;
if(!isset($_GET['ajax']) || (isset($_GET['ajax']) && !$_GET['ajax']))
include('header.php');
if(isset($_GET['action']) && in_array($_GET['action'], $actions))
include($_GET['action'].'.php');
else if(!isset($_GET['action']))
include('home.php');
else
echo 'Action not found, possible hacking attempt';
if(!isset($_GET['ajax']) || (isset($_GET['ajax']) && !$_GET['ajax']))
include('footer.php');
?>