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 print '<table bgcolor="red">';
21 print '<tr><th><b><font color="white">You already submitted results for this session</font></b></th><tr>';
23 print "You can only submit your calculated examples once!";
27 $excount = count($exchecked);
28 $donestring = implode(',', $exchecked);
30 $db->query("INSERT INTO workdone (mnumber,session,manydone,thisdone)
31 VALUES (\"$mnumber\", \"$sessionid\", \"$excount\", \"$donestring\")");
33 print '<table bgcolor="lightgreen">';
34 print '<tr><th><b><font color="white">submitted</font></b></th><tr>';
41 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
42 <table bgcolor="black">
43 <tr><th><b><font color="white">submit examples for <?php echo $SESSIONS[$SESSIONS_next]['timestr']; ?></font></b></th><tr>
48 <th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
51 <th align="left">Password:</th> <th align="left"><input type="text" name="password"></th>
54 <tr><th colspan=2></th></tr>
57 <th align="left">Examples:</th>
62 foreach (explode(",",$SESSIONS[$SESSIONS_next]['examples']) as $exid) {
63 print " <input type='checkbox' name='exchecked[]' value=$exid>$exid ";
65 if ($exnum%3 == 0) { print ""; }
71 <tr><th colspan=2></th></tr>
74 <th align="left"><input type="submit" name="submit" value="Submit"></th> <th></th>