Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit 779fcca

Browse files
committed
Programs can now be run with a timeout period.
Currently there is no way to trace from the output if a timeout has occured. This will be fixed in the next commit.
1 parent f1a4de8 commit 779fcca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

eval.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@
3939
$socket = fsockopen($compilerhost, $compilerport);
4040
if($socket) {
4141
fwrite($socket, $_POST['filename']."\n");
42-
$soln = str_replace("\n", '$_n_$', treat($_POST['soln']));
43-
fwrite($socket, $soln."\n");
44-
$query = "SELECT input, output FROM problems WHERE sl='".$_POST['id']."'";
42+
$query = "SELECT time, input, output FROM problems WHERE sl='".$_POST['id']."'";
4543
$result = mysql_query($query);
4644
$fields = mysql_fetch_array($result);
45+
fwrite($socket, $fields['time']."\n");
46+
$soln = str_replace("\n", '$_n_$', treat($_POST['soln']));
47+
fwrite($socket, $soln."\n");
4748
$input = str_replace("\n", '$_n_$', treat($fields['input']));
4849
fwrite($socket, $input."\n");
4950
fwrite($socket, $lang."\n");

0 commit comments

Comments
 (0)