#!/usr/bin/perl
#
# Petr Simandl, www.simandl.cz


print "Content-type: text/html\n\n";

print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache><style type=\"text/css\" media=\"screen\"> \@import \"../style.css\" ;</style></HEAD><BODY>\n";

#nocache!

$porty=`sudo /usr/local/bin/rtl83xx_asus 6a:61:62:00:00:02\@eth0 link-status | grep ^eth | sed 's/://g' | sed 's/eth0\\///g'`;
#print "<pre>$porty\n</pre>";

@pole = split("\n",$porty);
#print "<pre>@pole\n</pre>";

$pocet=scalar(@pole);
#print "<pre>$pocet\n</pre>";

#print "<a href=\"http://www.jablonka.cz\" target=\"_top\"><img src=../images/logo.png border=0 title=\"jablonka.cz\"></a>";

print "<table border=1>";
print "<tr>";

for ($i = 0; $i < 24; $i=$i+2)
{
    if (index($pole[$i],"LINK")!=-1)
    {
	print "<td valign=top bgcolor=#00FF00>$pole[$i]</td>";
    } 
    else 
    {
	print "<td valign=top bgcolor=#FFFFFF>$pole[$i]</td>";
    }
}
print "</tr><tr>";
for ($i = 1; $i < 25; $i=$i+2)
{
    if (index($pole[$i],"LINK")!=-1)
    {
	print "<td valign=top bgcolor=#00FF00>$pole[$i]</td>";
    } 
    else 
    {
	print "<td valign=top bgcolor=#FFFFFF>$pole[$i]</td>";
    }
}
print "</tr>";
print "</table>";

$adresa   = "$ENV{'REMOTE_ADDR'}";
$server   = "$ENV{'SERVER_NAME'}";

$date = `date`;
print "<BR>$date\n<BR>";

print "</center></BODY></HTML>";
