";
exit;
}
$sort = mysql_real_escape_string($_POST["dirsort"]); //$_GET["sort"];
$by = mysql_real_escape_string($_POST["sortby"]); //$_GET["by"];
$table = mysql_real_escape_string($_POST["table"]); //$_GET["table"];
$client= mysql_real_escape_string($_POST["client"]);
?>
// MYsql befehl basteln
$sql = "SELECT * FROM $table ORDER BY $by $sort;";
$result = mysql_query($sql);
echo "
";
if($table=='connections')
{
echo "Start Time | Stop Time | Client Name | Client IP | Download
| Upload |
\n";
}
else if($table=='month')
{
echo "Month | Year | Connection Time | Client Name | Download
| Upload |
\n";
}
else if($table=='year')
{
echo "Year | Connection Time | Client Name | Download
| Upload |
\n";
}
else
{
}
// ------------------------------------------------ Mysql lesen
if ($result)
{
while ($ar=mysql_fetch_array($result,MYSQL_ASSOC))
{
if($ar["sent"]>1024)
{
$sentbytes = round($ar["sent"]/1024,2) . " KiB";
if($ar["sent"]>1048576)
{
$sentbytes = round($ar["sent"]/1024/1024,2) . " MiB";
if($ar["sent"]>1073741824)
{
$sentbytes = round($ar["sent"]/1024/1024/1024,2) . " GiB";
}
}
}
else
{
$sentbytes = $ar["sent"]. " Byte";
}
if($ar["received"]>1024)
{
$receivedbytes = round($ar["received"]/1024,2) . " KiB";
if($ar["received"]>1048576)
{
$receivedbytes = round($ar["received"]/1024/1024,2) . " MiB";
if($ar["received"]>1073741824)
{
$receivedbytes = round($ar["received"]/1024/1024/1024,2) . " GiB";
}
}
}
else
{
$receivedbytes = $ar["received"]. " Byte";
}
if($table=='connections')
{
if($ar["stop"] != 0)
{
$stop = date("r",$ar["stop"]);
}
else
{
$stop = "running session";
}
if($client == "" || $ar["client"] == $client)
{
echo "",date("r",$ar["start"])," | ",$stop," | ",$ar["client"],
" | ",$ar["ip"],
" | ",$sentbytes,
" | ",$receivedbytes,
" |
\n";
}
}
else if($table=='month')
{
$hour = floor($ar["time"]/3600);
$min = floor($ar["time"]/60 - $hour *60);
$sec = $ar["time"]-$hour*3600-$min*60;
$timestring = $hour .":". $min .":". $sec;
if($client == "" || $ar["client"] == $client)
{
echo "",$ar["month"]," | ",$ar["year"]," | ",$timestring,
" | ",$ar["client"],
" | ",$sentbytes," | ",$receivedbytes,
" |
\n";
}
}
else if($table=='year')
{
$hour = floor($ar["time"]/3600);
$min = floor($ar["time"]/60 - $hour *60);
$sec = $ar["time"]-$hour*3600-$min*60;
$timestring = $hour .":". $min .":". $sec;
if($client == "" || $ar["client"] == $client)
{
echo "",$ar["year"]," | ",$timestring,
" | ",$ar["client"],
" | ",$sentbytes," | ",$receivedbytes,
" |
\n";
}
}
else
{
}
}
}
else
{
echo "
";
}
echo "
";
mysql_close();
?>