X-Git-Url: http://git.treefish.org/banana.git/blobdiff_plain/2c45a56043747bc7b524cdff4d00ff925b1a9544..209bfef78a9e045e91ae6b77501bf402379c8f00:/submit.php
diff --git a/submit.php b/submit.php
index 69d9ab8..d64b8da 100644
--- a/submit.php
+++ b/submit.php
@@ -1,37 +1,30 @@
$line) {
- $sessions[$line_num] = explode("\t",$line);
- }
-
- if ( strtotime("now") > strtotime(end($sessions)[0]) ) {
- print '
';
- print 'submission closed |
---|
';
- print '
';
- break;
+ if ( ! isset($SESSIONS_next) ) {
+ block("red", "submission closed");
+ exit;
}
if(isset($_POST['submit']) && $_POST['mnumber']!="") {
- require 'usercheck.inc';
-
+ require 'include/usercheck.inc';
+
$exchecked = $_POST['exchecked'];
$mnumber = $_POST['mnumber'];
- $sessionid = strtotime(end($sessions)[0]);
+ $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 '';
- print 'You already submitted results for this session |
---|
';
+ $db->query("DELETE FROM workdone WHERE mnumber = $mnumber AND session = $sessionid");
+ print '';
+ print 'deleted old submission |
---|
';
print '
';
- 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\")");
@@ -39,13 +32,14 @@
print '';
print 'submitted |
---|
';
print '
';
- break;
+ exit;
}
+
?>