-
Notifications
You must be signed in to change notification settings - Fork 0
/
bands.php
71 lines (70 loc) · 2.24 KB
/
bands.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
<?php
/*
* untitled
*
* Copyright 2023 Jim Richardson <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
* check system bans against sourcebans
*
*/
include "inc/master.inc.php"; // get set up
define('cr',PHP_EOL);
$games = array();
$sql = "select * from server1 where running = 1 order by `host_name` ASC";
$servers = db->get_results($sql);
foreach ($servers as $server) {
// loop the data
if(in_array($server['game'],$games)) { continue;}
$ban_location = "{$server['location']}/{$server['game']}/cfg/banned_ip.cfg";
$system_bans = explode(cr,trim(file_get_contents($ban_location)));
//echo "{$server['host_name']}<br>";
check_source_bans($system_bans);
$games[] = $server['game'];
}
function check_source_bans($data) {
// see if know these guys
foreach ($data as $user) {
// loop the system bans
//include "inc/config.php";
//print_r($config);
$sb = false;
$findip = explode(" ",$user);
//echo "{$findip[2]}<br>";
$x = trim($findip[2]);
$y = ip2long($x);
$sql = "select * from sb_bans where ip like '$x'";
//echo "using $sql ($y)<br>";
$isplayer = db2->get_row($sql);
$sql = "select * from players where ip like '$y'";
$isp = db->get_results($sql);
if($isplayer) {
$sb= true;
echo "{$isplayer['name']} is known to sourcebans<br>";
}
if ($isp) {
if($b === false) {
echo "{$isp[0]['name_c']} is a known player, but is not in the sourcebans table <br>";
}
else {
echo "{$isp[0]['name_c']} is a known player, and is in the sourcebans table <br>";
}
}
else {
echo "$x - ip not found in any database<br>";
}
}
}