";
        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"];
$moduleurl = $_SERVER["REQUEST_URI"];
$urlcut = strpos($moduleurl, "&");
if($urlcut > 0)
{
	$moduleurl = substr($moduleurl,0,$urlcut);
}
else
{
	if(strpos($moduleurl, "?") == 0)
	{
		$moduleurl = $_SERVER["REQUEST_URI"]."?site=1"; 	
	}
	if($_SERVER["REQUEST_URI"] == "/" || is_null($_SERVER["REQUEST_URI"]))
	{
		$moduleurl = "/index.php?site=1";
	}	
}
switch($uebergabe2)
{
	case 1:
		echo "Proxy repaired successfully!";
		break;
	default:
		break;
}
switch($uebergabe)
{
case 0:
echo "
    
         
Welcome ".$_SESSION["user_vorname"]." ".$_SESSION["user_nachname"]."!
![]()
Your Userstatistics:
";
    // MYsql befehl basteln
    $sql = "SELECT * FROM $table ORDER BY $by $sort;";
    $result = mysql_query($sql);
    echo "";
    if($table=='connections')
    {
        echo "
";
	mysql_close();
echo " \n";
    }
    else if($table=='month')
    {
        echo "Start Time Stop Time Client IP Download 
         Upload  \n";
    }
    else if($table=='year')
    {
        echo "Month Year Connection Time 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($ar["client"] == $_SESSION["user_nickname"])
                {
                    echo "Year Connection Time Download 
         Upload  \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($ar["client"] == $_SESSION["user_nickname"])
                {
                    echo "",date("r",$ar["start"])," ",$stop," ",$ar["ip"],
                    " ", $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($ar["client"] == $_SESSION["user_nickname"])
                {
                    echo "",$ar["month"]," ",$ar["year"]," ",$timestring,
                    " ", $sentbytes," ", $receivedbytes,
                    "  \n";
                }
            }
            else
            {
            }
        }
    }
    else
    {
        echo "",$ar["year"]," ",$timestring,
                    " ", $sentbytes," ", $receivedbytes,
                    " 
";
    }
    echo "
    VPN Config:
    
	
Die SchulVPN Client Software kann unter \"Services\" heruntergeladen werden!
Funktioniert der SchulVPN Proxy nicht mehr? Dann klicke auf \"Repair Proxy\".
Info: Jeder klick dieses Buttons wird in einer Datenbank mitgeloggt!