<?php require 'include/head.inc'; require 'include/db.inc'; require 'include/common.inc'; if(isset($_POST['submit']) && $_POST['stime']!="" && $_POST['examples']!="") { $db->query("INSERT INTO sessions (id,examples,nexamples) VALUES (" . strtotime(trim($_POST['stime'])) . ",'" . $_POST['examples'] . "','" . count(explode(',',$_POST['examples'])) . "')"); block("lightgreen", "added session"); } if(isset($_GET['delete'])) { $db->query("DELETE FROM sessions WHERE id=" . $_GET['delete']); block("red", "deleted session"); } require 'include/session.inc'; block("black", "add session"); ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table> <tr> <th align="left">Time:</th> <th><input type="text" name="stime"></th><th></th><th>(e.g. 10.9.2012 10:30)</th> </tr> <tr> <th align="left">Examples:</th> <th><input type="text" name="examples"></th> <th><input type="submit" name="submit" value="Add"></th><th>(e.g. 1a,1b,1c,2,3a,3b)</th> </tr> </table> </form> <?php if ( $SESSIONS_n == 0 ) { block("red", "no sessions defined"); exit; } block("black", "session overview"); print "<table>"; foreach ($SESSIONS as $session) { print "<tr>"; print "<td>" . $session['id'] . " </td>"; print "<td>" . $session['timestr'] . " </td>"; print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . " </td>"; if ($session['workdone'] == 0) { print "<td><a href='sessions.php?delete=" . $session['id'] . "'>delete</a></td>"; } else { print "<td>locked</td>"; } print "</tr>"; } print "</table>"; ?>