<?php

include 'site.php';

global $WWWHOST;
global $DBHOST;

$debug = 0;
$sheet = 'ipp.css';

// load an image file from the image directory
// validate request
if ($_SERVER[REQUEST_METHOD] != 'GET') { 
  exit ();
}

if ($debug) {
  echo "args: $args<br>";
}

# $basename may contain filename@filerule
$basename = $_GET[name];
$filerule = $_GET[rule];
$camera   = $_GET[camera];
$class_id = $_GET[class_id];

$title = $basename;

if ($debug) {
  echo "basename: $basename<br>";
  echo "filerule: $filerule<br>";
  echo "filerule: $filerule<br>";
  echo "camera:   $camera<br>";
  echo "class_id: $class_id<br>";
  exit ();
}

  echo "<html><head><title> $title </title></head>\n\n";
  echo "<link rel=\"STYLESHEET\" HREF=\"$sheet\">\n";
  echo "<body>\n";

  $root = "/ippMonitor";

  echo "<p style=\"font-size:50%\">host: $WWWHOST, db: $DBHOST</p>\n";
  echo "<table class=page cellspacing=10px><tr><td valign=top>\n";
  echo "base: $basename, camera: $camera, class_id: $class_id<br></td>\n";

  echo "<tr><td>\n";
  echo "<img src=\"getimage.php?name=$basename&rule=$filerule&camera=$camera&class_id=$class_id\">\n";
  echo "</td></tr></table>\n";
  echo "</body></html>\n\n";

exit ();
?>
