#!/usr/bin/perl

use vars qw/$home_dir/;

BEGIN {
  $home_dir = "/home/grapher2";
  open(FL,"/etc/hgs2.conf");
  ($t1,$t2,undef)=split(/:/,<FL>);
  close(FL);
  if ( $t1 ne ""){ $home_dir=$t1;}
};





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

($id)=@ARGV;
chomp($id);
($host,$option)=split(/\./,$id);
 $host=lc($host);
 $dir="$home_dir/data";

open(FL,"$dir/$host/info2");
(@graphs)=<FL>;
close(FL);
shift(@graphs);shift(@graphs);shift(@graphs);shift(@graphs);
#Start header
print '<body bgcolor=#FFE6C5>';
print "
<center>
<h2> Statistics of Host \u$host </h2>
</center>
";

$unique=time;
# this line lets the browser cache the image if the 5 min are not over
$unique=int($unique/300)*300;




#End header



print "<center>";

foreach $g (@graphs){
($g,undef)=split(/=/,$g);$g=~ s/ //gi;
print "
  <P>
  <img border=0 src=\"stats2.png\?$host.$g.1$option.$unique\">
";
}
print '
<center><font size=-2>&copy; FOXFIRE/Foxlink.Org</font></center>
';



