<?php
// $Id: viewreport.php,v 1.8 2007/08/24 18:25:15 koczan Exp $	

include("/s/www/html/includes/dept.head.html");
print "<title>Tech Report TR" . $_GET['report']. "</title>\n";
include("/s/www/html/includes/dept.headfinish.html");
include("/s/www/html/includes/dept.sidebar.html");
?>

<?php
if (!$_GET['report']) {
  print "<p>No report id selected.\n";

} else {
  $file = fopen("/s/www/html-data/reports", 'r');
  $found = 0;

  while (!feof($file)) {
    $id = chop(fgets($file));
    $author = chop(fgets($file));
    $title = chop(fgets($file));
    $year = chop(fgets($file));
    $abstract = chop(fgets($file));
    $filename = chop(fgets($file));

    if ($id == $_GET['report']) {
      print "
<h2><center>$title</center></h2>
<center><b>
$author
<br>
$year
</b></center>

<p>
$abstract

<p>
<a href=$filename>Download this report (PDF)</a>\n";
      $found = 1;
      break;
    }
  }

  fclose($file);

  if ($found == 0) {
    $given_report = $_GET['report'];
    print "<p>No tech report with id number $given_report has been found.";
  }
}
?>

<hr>
<p><a href=index.php>Return to tech report index</a>

<?php
include("/s/www/html/includes/dept.end.html");
?>
