<? 
//kontrola a start sesion s uzivatelovymi udaji
session_start();
if (!$_SESSION['nick'] )
{
 header("Location:index.php");
 exit;
}
include("./config.php"); //soubor s pripojenim k db

$sqlo="SELECT * FROM servers WHERE id_server=$id_server ";
$aao=MySQL_Query($sqlo);
while($bbo=mysql_fetch_array($aao))
{
echo "    	 <H2> Stats of server: ".$bbo["nazev"]."</H2>
    <br />
  	<br />
  	  	<H3> Live data</H3>";
  $cpu="No data";
  $usedram="No data";
  $allram="No data";
  $sqli="SELECT * FROM zatez WHERE id_server=$id_server Order by time DESC";
		$aai=MySQL_Query($sqli);
		while($bbi=mysql_fetch_array($aai))
		{
  	  	$cpu=$bbi["cpu"];
  	  	$usedram=round($bbi["ramused"]/1024);
  	  	$allram=round($bbi["ramall"]/1024);
  }  	
//	$bbo["Count(*)"];
	echo "CPU: $cpu % <br />RAM: $usedram MB of $allram MB<br /><br />
  	<H3> Last day</H3>";
//	$bbo["Count(*)"];
	echo "<img src=\"./my_zatez.php?id_server=".$bbo["id_server"]."&nazev=".$bbo["nazev"]."&dnu=1\" alt=\"Stats of server ".$bbo["nazev"]." - Last day\" title=\"Stats of server ".$bbo["nazev"]." - Last day\" /><br />";
	echo " <br />
  	<br />
  	<H3> Last week</H3>";
//	$bbo["Count(*)"];
	echo "<img src=\"./my_zatez.php?id_server=".$bbo["id_server"]."&nazev=".$bbo["nazev"]."&dnu=7\" alt=\"Stats of server ".$bbo["nazev"]." - Last week\" title=\"Stats of server ".$bbo["nazev"]." - Last week\" /><br />";
		echo " <br />
  	<br />
  	<H3> Last month</H3>";
//	$bbo["Count(*)"];
	echo "<img src=\"./my_zatez.php?id_server=".$bbo["id_server"]."&nazev=".$bbo["nazev"]."&dnu=30\" alt=\"Stats of server ".$bbo["nazev"]." - Last month\" title=\"Stats of server ".$bbo["nazev"]." - Last month\" /><br />";
			echo " <br />
  	<br />
  	<H3> Availability of server</H3>";
//	$bbo["Count(*)"];
	echo "<img src=\"./my_dostupnost.php?id_server=".$bbo["id_server"]."&nazev=".$bbo["nazev"]."\" alt=\"Availability of server ".$bbo["nazev"]." - Last month\" title=\"Availability of server ".$bbo["nazev"]." - Last month\" /><br />";
}
?>