From: <br...@us...> - 2008-06-22 08:35:12
|
Revision: 275 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=275&view=rev Author: brus07 Date: 2008-06-22 01:35:12 -0700 (Sun, 22 Jun 2008) Log Message: ----------- Web surface sending data in XML format. Mediator can read data in XML format and work with submitList. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/web/connect.php ACMServer/trunk/web/get.php Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2008-06-22 08:35:12 UTC (rev 275) @@ -31,10 +31,13 @@ { if (base.CountClients() > 0) { - Submit submit = new Submit(message); - if (dataContainer.Add(submit) == true) + SubmitList submitList = SubmitList.CreateFromXml(message); + for (int index = 0; index < submitList.Items.Length; index++) { - base.Send(submit.ToString()); + if (dataContainer.Add(submitList.Items[index]) == true) + { + base.Send(submitList.Items[index].ToString()); + } } } } Modified: ACMServer/trunk/web/connect.php =================================================================== --- ACMServer/trunk/web/connect.php 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/web/connect.php 2008-06-22 08:35:12 UTC (rev 275) @@ -1,4 +1,5 @@ <? - @mysql_connect("127.0.0.1", "root", "root"); + @mysql_connect("localhost", "acm", "masterro"); + //@mysql_connect("127.0.0.1", "root", "root"); - mysql_select_db("test"); + mysql_select_db("acm"); Modified: ACMServer/trunk/web/get.php =================================================================== --- ACMServer/trunk/web/get.php 2008-06-21 22:33:51 UTC (rev 274) +++ ACMServer/trunk/web/get.php 2008-06-22 08:35:12 UTC (rev 275) @@ -2,10 +2,22 @@ require_once("connect.php"); - $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL LIMIT 0 , 1;"; + $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL;"; $result = MySql_Query ($Query); - while($arr = mysql_fetch_array($result)) { - echo $arr[0]."$".$arr[1]; + $arr = mysql_fetch_array($result); + if ($arr != false) + { + header('Content-type: text/xml'); + echo "<?xml version=\"1.0\" encoding=\"utf-16\"?>"; + 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 "</submit>"; + }while($arr = mysql_fetch_array($result)); + echo "</submitList>"; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |