From: <br...@us...> - 2008-06-21 16:44:32
|
Revision: 272 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=272&view=rev Author: brus07 Date: 2008-06-21 05:59:37 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Start WebProject for web surface. Added Paths: ----------- ACMServer/trunk/web/ ACMServer/trunk/web/connect.php ACMServer/trunk/web/get.php ACMServer/trunk/web/insert.php ACMServer/trunk/web/set.php ACMServer/trunk/web/submit.php ACMServer/trunk/web/table.php Added: ACMServer/trunk/web/connect.php =================================================================== --- ACMServer/trunk/web/connect.php (rev 0) +++ ACMServer/trunk/web/connect.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,4 @@ +<? + @mysql_connect("127.0.0.1", "root", "root"); + + mysql_select_db("test"); Added: ACMServer/trunk/web/get.php =================================================================== --- ACMServer/trunk/web/get.php (rev 0) +++ ACMServer/trunk/web/get.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,11 @@ +<?php + + require_once("connect.php"); + + $Query = "SELECT `id`, `value` FROM `v3_submits` WHERE `result` IS NULL LIMIT 0 , 1;"; + + $result = MySql_Query ($Query); + + while($arr = mysql_fetch_array($result)) { + echo $arr[0]."$".$arr[1]; + } \ No newline at end of file Added: ACMServer/trunk/web/insert.php =================================================================== --- ACMServer/trunk/web/insert.php (rev 0) +++ ACMServer/trunk/web/insert.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,13 @@ +<?php + + require_once("connect.php"); + + if (isset($text)) + { + 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);"; + + $result = MySql_Query ($Query); + } Added: ACMServer/trunk/web/set.php =================================================================== --- ACMServer/trunk/web/set.php (rev 0) +++ ACMServer/trunk/web/set.php 2008-06-21 12:59:37 UTC (rev 272) @@ -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\" 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/submit.php =================================================================== --- ACMServer/trunk/web/submit.php (rev 0) +++ ACMServer/trunk/web/submit.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,4 @@ +<FORM action = "insert.php" method=post> + Text: <INPUT name=text> + <INPUT type=submit value=\xC2i\xE4i\xF1\xEB\xE0\xF2\xE8> +</FROM> \ No newline at end of file Added: ACMServer/trunk/web/table.php =================================================================== --- ACMServer/trunk/web/table.php (rev 0) +++ ACMServer/trunk/web/table.php 2008-06-21 12:59:37 UTC (rev 272) @@ -0,0 +1,33 @@ +<a href=submit.php>Submit</a><br> +<a href=get.php>Get</a><br> + +<?php + + require_once("connect.php"); + + $Query = "SELECT * FROM `v3_submits` ORDER BY `id` DESC 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>value</b>"; + echo "</td>\n"; + echo "\t\t<td>"; + echo "<b>result</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>"; + echo $arr[$i]; + echo "</td>\n"; + } + echo "\t</tr>\n"; + } + echo "</table>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |