From: <br...@us...> - 2008-12-12 10:11:45
|
Revision: 447 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=447&view=rev Author: brus07 Date: 2008-12-12 10:11:40 +0000 (Fri, 12 Dec 2008) Log Message: ----------- New version of Web client. Update table for work with parallel testing (on two TesterSystem). Small change. Modified Paths: -------------- ACMServer/trunk/web/action.php ACMServer/trunk/web/get.php ACMServer/trunk/web/insert.php ACMServer/trunk/web/submit.php ACMServer/trunk/web/table.php Added Paths: ----------- ACMServer/trunk/web/get/ ACMServer/trunk/web/get/connect.php ACMServer/trunk/web/get/diff.php ACMServer/trunk/web/get/get.php ACMServer/trunk/web/get/getfromold.php ACMServer/trunk/web/get/set.php ACMServer/trunk/web/get/table.php ACMServer/trunk/web/install.php ACMServer/trunk/web/start.sql Removed Paths: ------------- ACMServer/trunk/web/update.php ACMServer/trunk/web/update3.0.0.1.sql ACMServer/trunk/web/update3.0.0.2.sql Modified: ACMServer/trunk/web/action.php =================================================================== --- ACMServer/trunk/web/action.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/action.php 2008-12-12 10:11:40 UTC (rev 447) @@ -4,6 +4,14 @@ require_once("connect.php"); + + if (isset($delete) && $delete = 1) + { + $sql = "DELETE FROM `v3_submits` WHERE `id` = ".$id." LIMIT 1;"; + $result = MySql_Query ($sql); + echo "Delete $id<br>"; + } + if (isset($empty) && $empty=1) { $sql = 'UPDATE `v3_submits` SET `result` = NULL WHERE `id` >= '.$from.' AND `id` <= '.$to; Property changes on: ACMServer/trunk/web/get ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: ACMServer/trunk/web/get/connect.php =================================================================== --- ACMServer/trunk/web/get/connect.php (rev 0) +++ ACMServer/trunk/web/get/connect.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,3 @@ +<?php + + require_once("../connect.php"); \ No newline at end of file Added: ACMServer/trunk/web/get/diff.php =================================================================== --- ACMServer/trunk/web/get/diff.php (rev 0) +++ ACMServer/trunk/web/get/diff.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,126 @@ +<a href=submit.php>Submit</a><br> +<a href=get.php>Get</a><br> +<a href=table.php>Table</a><br> +<?php + if (isset($full) != true || $full != 1) + { + echo "<a href=\"diff.php?full=1\">Full table</a><br>"; + } + else + { + echo "<a href=\"diff.php?full=0\">Small table</a><br>"; + } +?> + +<?php + require_once("connect.php"); + + function getMax() + { + $sql = 'SELECT MAX(`id`) FROM `v3_submits`'; + $result = MySql_Query ($sql); + while($arr = mysql_fetch_array($result)) { + return $arr[0]; + } + return -1; + } +?> + +<FORM action = "../action.php?delete=1" method=post> + ID: <INPUT name=id value=-1> + <INPUT type=submit value="Delete"> +</FORM> + +<FORM action = "../action.php?empty=1" method=post> + Empty: <INPUT name=from value=<?php echo getMax();?> >- + <INPUT name=to value=<?php echo getMax();?> > + <INPUT type=submit value=run> +</FROM> + + +<?php + require_once("connect.php"); + + $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC"; + if (isset($full) != true || $full != 1) + { + $Query .= " LIMIT 0 , 20;"; + } + + $result = MySql_Query ($Query); + echo "<table border=1>\n"; + echo "\t<tr>\n"; + echo "\t\t<td>"; + echo "<b>id</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>Problem</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>language</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>result</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedMemory</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedTime</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealStatus</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealTimeWorked</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealMemoryUsed</b>"; + echo "</td>\n"; + echo "\t</tr>\n"; + while($arr = mysql_fetch_array($result)) { + echo "\t<tr>\n"; + + echo "\t\t<td>"; + $arr[0] = $bodytag = str_replace("\r\n", "<br>", $arr[0]); + echo $arr[0]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[5] = $bodytag = str_replace("\r\n", "<br>", $arr['problemID']); + echo $arr[5]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[1] = $bodytag = str_replace("\r\n", "<br>", $arr['language']); + echo $arr[1]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[2] = $bodytag = str_replace("\r\n", "<br>", $arr[2]); + echo $arr[2]; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[4]/1000.0; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[3]/1000.0; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['Status']; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['TimeWorked']; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['MemoryUsed']; + echo "</td>\n"; + + echo "\t</tr>\n"; + } + echo "</table>\n"; Added: ACMServer/trunk/web/get/get.php =================================================================== --- ACMServer/trunk/web/get/get.php (rev 0) +++ ACMServer/trunk/web/get/get.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,27 @@ +<?php + + require_once("connect.php"); + + require_once("getfromold.php"); + + $Query = "SELECT `id`, `value`, `problemID`, `language` FROM `v3_submits` WHERE `result` IS NULL;"; + + $result = MySql_Query ($Query); + + $arr = mysql_fetch_array($result); + if ($arr != false) + { + header('Content-type: text/xml'); + echo "<?xml version=\"1.0\" encoding=\"utf-16\"?>"; + echo "<?xml-stylesheet type=\"text/xsl\" href=\"../get.xsl\"?>"; + echo "<submitList xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; + do{ + echo "<submit>"; + echo "<id>".$arr['id']."</id>"; + echo "<problem>".$arr['problemID']."</problem>"; + echo "<sourceCode>".htmlspecialchars($arr['value'])."</sourceCode>"; + echo "<language>".$arr['language']."</language>"; + echo "</submit>"; + }while($arr = mysql_fetch_array($result)); + echo "</submitList>"; + } \ No newline at end of file Added: ACMServer/trunk/web/get/getfromold.php =================================================================== --- ACMServer/trunk/web/get/getfromold.php (rev 0) +++ ACMServer/trunk/web/get/getfromold.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,42 @@ +<?php + $sql = 'SELECT SubmitID, submits.problemID, Source, submits.Language, submits.`Status`, submits.TestNumber, submits.TimeWorked, submits.MemoryUsed FROM submits LEFT JOIN v3_submits ON submits.SubmitID = v3_submits.id WHERE submits.`Status` > 0 AND submits.`Status` < 11 AND submits.FirstOnly=0 AND v3_submits.id IS NULL LIMIT 1 '; + $result = MySql_Query($sql); + if ($result != FALSE) + { + if ($result = mysql_fetch_array($result)) + { + $id = $result['SubmitID']; + $source = $result['Source']; + + $status = $result['Status']; + if ($status == 1) + $status = "CompileErr"; + if ($status == 2) + $status = "RealTimeLimit"; + if ($status == 3) + $status = "WrongAnswer"; + if ($status == 4) + $status = "TimeLimit"; + if ($status == 5) + $status = "MemoryLimit"; + if ($status == 6) + $status = "OutputLimit"; + if ($status == 7) + $status = "InternalError"; + if ($status == 9) + $status = "PresentationError"; + if ($status == 10) + $status = "Accepted"; + $problem = $result['problemID']; + $timeWorked = $result['TimeWorked']; + $memoryUsed = $result['MemoryUsed']; + $language = $result['Language']; + if ($language == 3) + $language = 1; + + $Query = "INSERT INTO `v3_submits` (`id`, `value`, `result`, `problemID`, `language`, `Status`, `TimeWorked`, `MemoryUsed`)" + ."VALUES ($id, '".mysql_real_escape_string($source)."', NULL, $problem, $language, '$status', $timeWorked, $memoryUsed);"; + + $result = MySql_Query($Query); + } + } \ No newline at end of file Added: ACMServer/trunk/web/get/set.php =================================================================== --- ACMServer/trunk/web/get/set.php (rev 0) +++ ACMServer/trunk/web/get/set.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,16 @@ +<?php + + require_once("connect.php"); + + if (isset($res) && isset($id)) + { + echo $res; + echo "<p>"; + echo $id; + $res = mysql_real_escape_string($res); + $Query = "UPDATE `v3_submits` SET `result` = \"$res\", `usedMemory`=$usedMemory, `usedTime`=$usedTime WHERE `result` IS NULL AND `id` = $id LIMIT 1 ;"; + + echo "<p>"; + echo $Query; + $result = MySql_Query ($Query); + } \ No newline at end of file Added: ACMServer/trunk/web/get/table.php =================================================================== --- ACMServer/trunk/web/get/table.php (rev 0) +++ ACMServer/trunk/web/get/table.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,132 @@ +<a href=../submit.php>Submit</a><br> +<a href=get.php>Get</a><br> +<a href=diff.php>Different table</a><br> +<?php + if (isset($full) != true || $full != 1) + { + echo "<a href=\"table.php?full=1\">Full table</a><br>"; + } + else + { + echo "<a href=\"table.php?full=0\">Small table</a><br>"; + } +?> + +<?php + require_once("connect.php"); + + function getMax() + { + $sql = 'SELECT MAX(`id`) FROM `v3_submits`'; + $result = MySql_Query ($sql); + while($arr = mysql_fetch_array($result)) { + return $arr[0]; + } + return -1; + } +?> + +<FORM action = "../action.php?delete=1" method=post> + ID: <INPUT name=id value=-1> + <INPUT type=submit value="Delete"> +</FORM> + +<FORM action = "../action.php?empty=1" method=post> + Empty: <INPUT name=from value=<?php echo getMax();?> >- + <INPUT name=to value=<?php echo getMax();?> > + <INPUT type=submit value=run> +</FROM> + +<?php + + $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC"; + if (isset($full) != true || $full != 1) + { + $Query .= " LIMIT 0 , 20;"; + } + + $result = MySql_Query ($Query); + echo "<table border=1>\n"; + echo "\t<tr>\n"; + echo "\t\t<td>"; + echo "<b>id</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>Problem</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>value</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>language</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>result</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedMemory</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>usedTime</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealStatus</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealTimeWorked</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>RealMemoryUsed</b>"; + echo "</td>\n"; + echo "\t</tr>\n"; + while($arr = mysql_fetch_array($result)) { + echo "\t<tr>\n"; + + echo "\t\t<td>"; + $arr[0] = $bodytag = str_replace("\r\n", "<br>", $arr[0]); + echo $arr[0]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[5] = $bodytag = str_replace("\r\n", "<br>", $arr['problemID']); + echo $arr[5]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[1] = $bodytag = str_replace("\r\n", "<br>", htmlentities($arr[1])); + echo $arr[1]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[1] = $bodytag = str_replace("\r\n", "<br>", $arr['language']); + echo $arr[1]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[2] = $bodytag = str_replace("\r\n", "<br>", $arr[2]); + echo $arr[2]; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[4]/1000.0; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[3]/1000.0; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['Status']; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['TimeWorked']; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr['MemoryUsed']; + echo "</td>\n"; + + echo "\t</tr>\n"; + } + echo "</table>\n"; Modified: ACMServer/trunk/web/get.php =================================================================== --- ACMServer/trunk/web/get.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/get.php 2008-12-12 10:11:40 UTC (rev 447) @@ -2,7 +2,7 @@ require_once("connect.php"); - $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL;"; + $Query = "SELECT `id`, `value`, `problemID`, `language` FROM `v3_submits` WHERE `result` IS NULL;"; $result = MySql_Query ($Query); @@ -11,12 +11,14 @@ { header('Content-type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"utf-16\"?>"; + echo "<?xml-stylesheet type=\"text/xsl\" href=\"get.xsl\"?>"; echo "<submitList xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; do{ echo "<submit>"; - echo "<id>".$arr[0]."</id>"; - echo "<sourceCode>".$arr[1]."</sourceCode>"; - echo "<language>2</language>"; + echo "<id>".$arr['id']."</id>"; + echo "<problem>".$arr['problemID']."</problem>"; + echo "<sourceCode>".htmlspecialchars($arr['value'])."</sourceCode>"; + echo "<language>".$arr['language']."</language>"; echo "</submit>"; }while($arr = mysql_fetch_array($result)); echo "</submitList>"; Modified: ACMServer/trunk/web/insert.php =================================================================== --- ACMServer/trunk/web/insert.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/insert.php 2008-12-12 10:11:40 UTC (rev 447) @@ -7,7 +7,6 @@ echo $text; echo "<p>"; echo mysql_real_escape_string($text); - $Query = "INSERT INTO `v3_submits` ( `id` , `value` , `result` ) VALUES ('', '".mysql_real_escape_string($text)."', NULL);"; - + $Query = "INSERT INTO `v3_submits` ( `id` , `value` , `result`, `problemID`, `language`) VALUES ('', '".mysql_real_escape_string($text)."', NULL, ".$problem.", ".$language.");"; $result = MySql_Query ($Query); } Added: ACMServer/trunk/web/install.php =================================================================== --- ACMServer/trunk/web/install.php (rev 0) +++ ACMServer/trunk/web/install.php 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,12 @@ +<?php + + require_once("connect.php"); + + $filename = "start.sql"; + $handle = fopen($filename, "rb"); + $contents = fread($handle, filesize($filename)); + fclose($handle); + + $sql = $contents; + + $result = MySql_Query ($sql); Added: ACMServer/trunk/web/start.sql =================================================================== --- ACMServer/trunk/web/start.sql (rev 0) +++ ACMServer/trunk/web/start.sql 2008-12-12 10:11:40 UTC (rev 447) @@ -0,0 +1,31 @@ +-- phpMyAdmin SQL Dump +-- version 2.6.3-pl1 +-- http://www.phpmyadmin.net +-- +-- \xD5\xEE\xF1\xF2: localhost +-- \xD7\xE0\xF1 \xF1\xF2\xE2\xEE\xF0\xE5\xED\xED\xFF: \xC3\xF0\xF3 12 2008 \xF0., 11:11 +-- \xC2\xE5\xF0\xF1\xB3\xFF \xF1\xE5\xF0\xE2\xE5\xF0\xE0: 4.0.14 +-- \xC2\xE5\xF0\xF1\xB3\xFF PHP: 4.3.4 +-- +-- \xC1\xC4: `acm` +-- + +-- -------------------------------------------------------- + +-- +-- \xD1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xE0 \xF2\xE0\xE1\xEB\xE8\xF6\xB3 `v3_submits_se` +-- + +CREATE TABLE `v3_submits` ( + `id` int(11) NOT NULL auto_increment, + `value` blob NOT NULL, + `result` varchar(255) default NULL, + `usedMemory` varchar(20) NOT NULL default '', + `usedTime` varchar(20) NOT NULL default '', + `language` int(11) NOT NULL default '1', + `problemID` int(11) NOT NULL default '0', + `Status` varchar(255) NOT NULL default '', + `TimeWorked` varchar(20) NOT NULL default '', + `MemoryUsed` varchar(20) NOT NULL default '', + PRIMARY KEY (`id`) +) TYPE=MyISAM AUTO_INCREMENT=1 ; Modified: ACMServer/trunk/web/submit.php =================================================================== --- ACMServer/trunk/web/submit.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/submit.php 2008-12-12 10:11:40 UTC (rev 447) @@ -1,4 +1,10 @@ <FORM action = "insert.php" method=post> - Text: <br><textarea name=text rows="20" wrap="VIRTUAL" cols="65"></textarea><br> + ProblemID: <INPUT name=problem type=edit value="1"><br> + LanguageID: + <select name=language size="1" name="lang" class="textbox"> + <option value="1" selected="selected">Pascal</option> + <option value="2">C++</option> + </select><br> + SourceCode: <br><textarea name=text rows="20" wrap="VIRTUAL" cols="65"></textarea><br> <INPUT type=submit value=\xC2i\xE4i\xF1\xEB\xE0\xF2\xE8> </FROM> \ No newline at end of file Modified: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/table.php 2008-12-12 10:11:40 UTC (rev 447) @@ -24,6 +24,11 @@ return -1; } ?> + +<FORM action = "action.php?delete=1" method=post> + ID: <INPUT name=id value=-1> + <INPUT type=submit value="Delete"> +</FORM> <FORM action = "action.php?empty=1" method=post> Empty: <INPUT name=from value=<?php echo getMax();?> >- @@ -46,9 +51,15 @@ echo "<b>id</b>"; echo "</td>\n"; echo "\t\t<td>"; + echo "<b>Problem</b>"; + echo "</td>\n"; + echo "\t\t<td>"; echo "<b>value</b>"; echo "</td>\n"; echo "\t\t<td>"; + echo "<b>language</b>"; + echo "</td>\n"; + echo "\t\t<td>"; echo "<b>result</b>"; echo "</td>\n"; echo "\t\t<td>"; @@ -57,22 +68,44 @@ echo "\t\t<td>"; echo "<b>usedTime</b>"; echo "</td>\n"; + echo "\t</tr>\n"; while($arr = mysql_fetch_array($result)) { echo "\t<tr>\n"; - for ($i=0; $i<3; $i++) - { + echo "\t\t<td>"; - $arr[$i] = $bodytag = str_replace("\r\n", "<br>", $arr[$i]); - echo $arr[$i]; + $arr[0] = $bodytag = str_replace("\r\n", "<br>", $arr[0]); + echo $arr[0]; echo "</td>\n"; - } - for ($i=3; $i<5; $i++) - { + echo "\t\t<td>"; - echo $arr[$i]/1000.0; + $arr[5] = $bodytag = str_replace("\r\n", "<br>", $arr['problemID']); + echo $arr[5]; echo "</td>\n"; - } + + echo "\t\t<td>"; + $arr[1] = $bodytag = str_replace("\r\n", "<br>", htmlentities($arr[1])); + echo $arr[1]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[1] = $bodytag = str_replace("\r\n", "<br>", $arr['language']); + echo $arr[1]; + echo "</td>\n"; + + echo "\t\t<td>"; + $arr[2] = $bodytag = str_replace("\r\n", "<br>", $arr[2]); + echo $arr[2]; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[4]/1000.0; + echo "</td>\n"; + + echo "\t\t<td>"; + echo $arr[3]/1000.0; + echo "</td>\n"; + echo "\t</tr>\n"; } echo "</table>\n"; Deleted: ACMServer/trunk/web/update.php =================================================================== --- ACMServer/trunk/web/update.php 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/update.php 2008-12-12 10:11:40 UTC (rev 447) @@ -1,7 +0,0 @@ -<?php - - require_once("connect.php"); - - $sql = 'ALTER TABLE `v3_submits` CHANGE `value` `value` BLOB NOT NULL'; - - $result = MySql_Query ($sql); \ No newline at end of file Deleted: ACMServer/trunk/web/update3.0.0.1.sql =================================================================== --- ACMServer/trunk/web/update3.0.0.1.sql 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/update3.0.0.1.sql 2008-12-12 10:11:40 UTC (rev 447) @@ -1,5 +0,0 @@ --- --- Insert new column to table --- -ALTER TABLE `v3_submits` ADD `usedMemory` VARCHAR( 20 ) NOT NULL , -ADD `usedTime` VARCHAR( 20 ) NOT NULL ; \ No newline at end of file Deleted: ACMServer/trunk/web/update3.0.0.2.sql =================================================================== --- ACMServer/trunk/web/update3.0.0.2.sql 2008-12-11 14:08:54 UTC (rev 446) +++ ACMServer/trunk/web/update3.0.0.2.sql 2008-12-12 10:11:40 UTC (rev 447) @@ -1,5 +0,0 @@ --- --- Change type and length of field 'value' --- - -ALTER TABLE `v3_submits` CHANGE `value` `value` BLOB NOT NULL \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |