#! /usr/bin/perl

use CGI;

$lonlat = CGI::param('lonlat');
($lon,$lat) = split(',',$lonlat);
$lon = Scrub($lon);
$lat = Scrub($lat);

$rand = time;

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

print <<EOF
<html>
  <head>
    <script src="/Multigraph.js"></script>
  </head>
  <body onload="new Multigraph('graphdiv', 'ndfdmugl.cgi?args=$lon,$lat,temp,$rand', [800,300]);">
    <div id="graphdiv"/>
  </body>
</html>
EOF
;

sub Scrub {
    my $x = shift;
    $x =~ s/[^A-Za-z0-9_\.-]//g;
    return $x;
}