2 require 'include/head.inc';
3 require 'include/session.inc';
4 require 'include/common.inc';
6 if ( ! isset($SESSIONS_next) ) {
7 block("red", "submission closed");
11 if(isset($_POST['submit']) && $_POST['mnumber']!="") {
12 require 'include/usercheck.inc';
14 $exchecked = $_POST['exchecked'];
16 $mnumber = $_POST['mnumber'];
17 $sessionid = $SESSIONS[$SESSIONS_next]['id'];
19 if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $sessionid")->fetch(PDO::FETCH_NUM)[0] == 1) {
20 $db->query("DELETE FROM workdone WHERE mnumber = $mnumber AND session = $sessionid");
21 print '<table bgcolor="lightgreen">';
22 print '<tr><th><b><font color="white">deleted old submission</font></b></th><tr>';
26 $excount = count($exchecked);
27 $donestring = implode(',', $exchecked);
29 $db->query("INSERT INTO workdone (mnumber,session,manydone,thisdone)
30 VALUES (\"$mnumber\", \"$sessionid\", \"$excount\", \"$donestring\")");
32 print '<table bgcolor="lightgreen">';
33 print '<tr><th><b><font color="white">submitted</font></b></th><tr>';
40 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
41 <table bgcolor="black">
42 <tr><th><b><font color="white">submit examples for <?php echo $SESSIONS[$SESSIONS_next]['timestr']; ?></font></b></th><tr>
47 <th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
50 <th align="left">Password:</th> <th align="left"><input type="text" name="password"></th>
53 <tr><th colspan=2></th></tr>
56 <th align="left">Examples:</th>
61 foreach (explode(",",$SESSIONS[$SESSIONS_next]['examples']) as $exid) {
62 print " <input type='checkbox' name='exchecked[]' value=$exid>$exid ";
64 if ($exnum%3 == 0) { print ""; }
70 <tr><th colspan=2></th></tr>
73 <th align="left"><input type="submit" name="submit" value="Submit"></th> <th></th>