2   require 'include/head.inc';
 
   3   require 'include/db.inc';
 
   4   require 'include/common.inc'; 
 
   6   if(isset($_POST['submit']) && $_POST['stime']!="" && $_POST['score']!="") {
 
   7     $db->query("INSERT INTO exams (id,score) VALUES (" . strtotime(trim($_POST['stime'])) . ",'" . $_POST['score'] . "')");
 
   8     block("lightgreen", "added exam");
 
  11   if(isset($_GET['delete'])) {
 
  12     $db->query("DELETE FROM exams WHERE id=" . $_GET['delete']);
 
  13     block("red", "deleted exam");
 
  16   require 'include/exams.inc';
 
  18   block("black", "add exam");
 
  21 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
 
  24       <th align="left">Time:</th> <th><input type="text" name="stime"></th><th></th><th>(e.g. 10.9.2012 10:30)</th>
 
  27       <th align="left">Score:</th> <th><input type="text" name="score"></th>
 
  28       <th><input type="submit" name="submit" value="Add"></th><th>(e.g. 4,5,5)</th>
 
  34   if ( $EXAMS_n == 0 ) {
 
  35     block("red", "no exams defined");
 
  39   block("black", "exam overview");
 
  42   foreach ($EXAMS as $exam) {
 
  44     print "<td>" . $exam['id'] . "  </td>";
 
  45     print "<td>" . $exam['timestr'] . "  </td>";
 
  46     print "<td>" . $exam['scorestr'] . "(" . $exam['nquests'] . ")" . "  </td>";
 
  47     print "<td>" . $exam['totscore'] . "  </td>";
 
  48     if ($exam['nresults'] == 0) {
 
  49       print "<td><a href='exams.php?delete=" . $exam['id']  . "'>delete</a></td>";
 
  51     else { print "<td>locked</td>"; }