{'database'}->{'enable'}) {
$ip_matches = $config->{'database'}->{'ip_matches'};
if ( (! $ip_matches) || ($ip_matches && preg_match("/$ip_matches/",$_SERVER['REMOTE_ADDR'])) ) {
Debug("Saving to database");
$dbh = mysql_connect(
$config->{'database'}->{'host'},
$config->{'database'}->{'user'},
$config->{'database'}->{'password'}
);
$dbs = mysql_select_db( $config->{'database'}->{'database'}, $dbh);
$table = $config->{'database'}->{'table'};
$ip = $_SERVER['REMOTE_ADDR'];
$upspeed = addslashes($_GET['upspeed']);
$downspeed = addslashes($_GET['downspeed']);
$sql = "
INSERT INTO `$table`
SET
`ip_string` = '$ip',
`ip` = INET_ATON('$ip'),
`timestamp` = NOW(),
`upspeed` = '$upspeed',
`downspeed` = '$downspeed'
";
mysql_query($sql,$dbh);
}
}
?>
1024) {
$cleanspeed = round($kbps / 1024,2) . " Mbps";
} else {
$cleanspeed = round($kbps,2). " kbps";
}
return $cleanspeed;
}
?>