if ( ! isset($SESSIONS_next) ) {
block("red", "submission closed");
- break;
+ exit;
}
if(isset($_POST['submit']) && $_POST['mnumber']!="") {
$sessionid = $SESSIONS[$SESSIONS_next]['id'];
if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $sessionid")->fetch(PDO::FETCH_NUM)[0] == 1) {
- print '<table bgcolor="red">';
- print '<tr><th><b><font color="white">You already submitted results for this session</font></b></th><tr>';
+ $db->query("DELETE FROM workdone WHERE mnumber = $mnumber AND session = $sessionid");
+ print '<table bgcolor="lightgreen">';
+ print '<tr><th><b><font color="white">deleted old submission</font></b></th><tr>';
print '</table>';
- print "You can only submit your calculated examples once!";
- break;
}
$excount = count($exchecked);
- $donestring = implode(', ', $exchecked);
+ $donestring = implode(',', $exchecked);
$db->query("INSERT INTO workdone (mnumber,session,manydone,thisdone)
VALUES (\"$mnumber\", \"$sessionid\", \"$excount\", \"$donestring\")");
print '<table bgcolor="lightgreen">';
print '<tr><th><b><font color="white">submitted</font></b></th><tr>';
print '</table>';
- break;
+ exit;
}
?>
<th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
</tr>
<tr>
- <th align="left">Password:</th> <th align="left"><input type="text" name="password"></th>
+ <th align="left">Password:</th> <th align="left"><input type="password" name="password"></th>
</tr>
<tr><th colspan=2></th></tr>