51950980dbad1976a2fc48f776ffbdcf8a740693
2 error_reporting(E_ALL
& ~
(E_NOTICE|E_STRICT
));
3 define("INT_DAILY", 60*60*24*2);
4 define("INT_WEEKLY", 60*60*24*8);
5 define("INT_MONTHLY", 60*60*24*35);
6 define("INT_YEARLY", 60*60*24*400);
11 require("config.conf.php");
13 function ConnectDb() {
14 global $db_connect_string;
16 $db = new PDO($db_connect_string);
17 } catch (PDOException
$ex) {
18 die("DB Error, could not connect to database: " . $ex->getMessage());
23 function fmtb($kbytes)
47 return(sprintf("<td align=right><tt>%.1f%s</td>", $Output, $Suffix));
50 function ip2s32($ip) {
52 return ($i & 0x80000000 ?
'-' . ((~
$i & 0x7fffffff)+
1) : ''. ($i & 0x7fffffff));
55 function prepare_sql_subnet($subnet) {
56 list($snet, $smask) = explode('/', $subnet);
57 $inet = ip2s32($snet);
58 if($smask > 0 && $smask < 32) {
59 $mask = -1 << (32 - (int)$smask);
60 return "and (ip & $mask = $inet)";
62 return "and ip = " . $inet;