4 $lines = file('var/sessions.txt');
6 foreach ($lines as $line_num => $line) {
7 $sessions[$line_num] = explode("\t",$line);
10 if ( strtotime("now") > strtotime(end($sessions)[0]) ) {
11 print '<table bgcolor="red">';
12 print '<tr><th><b><font color="white">submission closed</font></b></th><tr>';
17 if(isset($_POST['submit']) && $_POST['mnumber']!="") {
18 require 'usercheck.inc';
20 $exchecked = $_POST['exchecked'];
22 $mnumber = $_POST['mnumber'];
23 $sessionid = strtotime(end($sessions)[0]);
25 if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $sessionid")->fetch(PDO::FETCH_NUM)[0] == 1) {
26 print '<table bgcolor="red">';
27 print '<tr><th><b><font color="white">You already submitted results for this session</font></b></th><tr>';
29 print "You can only submit your calculated examples once!";
33 $excount = count($exchecked);
34 $donestring = implode(', ', $exchecked);
36 $db->query("INSERT INTO workdone (mnumber,session,manydone,thisdone)
37 VALUES (\"$mnumber\", \"$sessionid\", \"$excount\", \"$donestring\")");
39 print '<table bgcolor="lightgreen">';
40 print '<tr><th><b><font color="white">submitted</font></b></th><tr>';
46 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
47 <table bgcolor="black">
48 <tr><th><b><font color="white">submit examples for <?php echo end($sessions)[0]; ?></font></b></th><tr>
53 <th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
56 <th align="left">Password:</th> <th align="left"><input type="text" name="password"></th>
59 <tr><th colspan=2></th></tr>
62 <th align="left">Examples:</th>
67 foreach (explode(",",end($sessions)[1]) as $exid) {
68 print " <input type='checkbox' name='exchecked[]' value=$exid>$exid ";
70 if ($exnum%3 == 0) { print ""; }
76 <tr><th colspan=2></th></tr>
79 <th align="left"><input type="submit" name="submit" value="Submit"></th> <th></th>