$line) {
$sessions[$line_num] = explode("\t",$line);
}
if ( strtotime("now") > strtotime(end($sessions)[0]) ) {
print '
';
print 'submission closed |
---|
';
print '
';
break;
}
if(isset($_POST['submit']) && $_POST['mnumber']!="") {
require 'usercheck.inc';
$exchecked = $_POST['exchecked'];
$mnumber = $_POST['mnumber'];
$sessionid = strtotime(end($sessions)[0]);
if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $sessionid")->fetch(PDO::FETCH_NUM)[0] == 1) {
print '';
print 'You already submitted results for this session |
---|
';
print '
';
print "You can only submit your calculated examples once!";
break;
}
$excount = count($exchecked);
$donestring = implode(', ', $exchecked);
$db->query("INSERT INTO workdone (mnumber,session,manydone,thisdone)
VALUES (\"$mnumber\", \"$sessionid\", \"$excount\", \"$donestring\")");
print '';
print 'submitted |
---|
';
print '
';
break;
}
if(trim(end($sessions)[0]) == "") {
print '';
print 'no exercises defined |
---|
';
print '
';
break;
}
?>