function getSubmissionInfo($pid, $sid) { $con = get_database_object(); $tidQuery = "SELECT * FROM problem_testcase WHERE problem_id = '{$pid}'"; $tidRs = mysql_query($tidQuery) or die(mysql_error()); $j = 0; while ($tidRow = mysql_fetch_array($tidRs)) { $tid[] = $tidRow['id']; $timeLimit[] = $tidRow['time_limit']; $memoryLimit[] = $tidRow['memory_limit']; echo "tid:" . $tid[$j] . "\n"; echo "timeLimit:" . $timeLimit[$j] . "\n"; echo "memoryLimit:" . $memoryLimit[$j] . "\n"; $j++; } $pidQuery = "SELECT * FROM problem_problem WHERE id = '{$pid}'"; $pidRs = mysql_query($pidQuery) or die(mysql_error()); $pidRow = mysql_fetch_array($pidRs); $judge_type = $pidRow['judge_type']; $judge_language = $pidRow['judge_language']; echo "judge_type " . $judge_type . "\n"; echo "judge_language " . $judge_language . "\n"; $result = array("tid" => $tid, "timeLimit" => $timeLimit, "memoryLimit" => $memoryLimit, "judge_type" => $judge_type, "judge_language" => $judge_language); return $result; }
$con = get_database_object(); $updQuery = "UPDATE problem_submission SET status = 'JUDGING' WHERE id = " . $sid; echo $updQuery . " " . $sid . "\n"; mysql_query($updQuery) or die(mysql_error()); $judgeIP = $destMachine['machineIP']; $judgePage = "interface.php"; $judgeURL = $judgeIP . "/" . $judgePage; echo "judgeURL=" . $judgeURL . "\n"; echo "send!\n"; writeLog("send info to judge " . $destMachine['machineName'] . ":" . $destMachine['machineIP']); $arg = $sid . " " . $pid . " " . $codeLanType . " " . $destMachine['machineName'] . " " . $judgeURL; $handle = popen("/usr/bin/php submit_curl.php " . $arg . " & >> output.html", "w"); pclose($handle); echo "after popen\n"; } else { $con = get_database_object(); $updQuery = "UPDATE problem_submission SET status = 'JUDGING' WHERE id = " . $sid; echo $updQuery . " " . $sid . "\n"; mysql_query($updQuery) or die(mysql_error()); writeLog("send info to other judge"); $arg = $codeLanType . " " . $pid . " " . $outside_web . " " . $sid; if (file_exists("/var/nthuoj/outsideConnection/sendToOtherJudge.sh")) { $handle = popen("/var/nthuoj/outsideConnection/sendToOtherJudge.sh " . $arg . " & >> output.html", "w"); pclose($handle); } else { writeLog("send info to other judge error(no judge)"); } } } sleep(10); $i++;