PageRenderTime 52ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/boca-1.5.0/src/private/autojudging.php

https://bitbucket.org/jorgenio/boca
PHP | 489 lines | 424 code | 28 blank | 37 comment | 106 complexity | 810a96de60985cf336dc6542fd2061a4 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. //BOCA Online Contest Administrator
  4. // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
  5. //
  6. // This program is free software: you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // Last modified 06/aug/2012 by cassio@ime.usp.br
  19. $ds = DIRECTORY_SEPARATOR;
  20. if($ds=="") $ds = "/";
  21. if(is_readable('/etc/boca.conf')) {
  22. $pif=parse_ini_file('/etc/boca.conf');
  23. $bocadir = trim($pif['bocadir']) . $ds . 'src';
  24. } else {
  25. $bocadir = getcwd();
  26. }
  27. if(is_readable($bocadir . $ds . '..' .$ds . 'db.php')) {
  28. require_once($bocadir . $ds . '..' .$ds . 'db.php');
  29. require_once($bocadir . $ds . '..' .$ds . 'version.php');
  30. } else {
  31. if(is_readable($bocadir . $ds . 'db.php')) {
  32. require_once($bocadir . $ds . 'db.php');
  33. require_once($bocadir . $ds . 'version.php');
  34. } else {
  35. echo "unable to find db.php";
  36. exit;
  37. }
  38. }
  39. if (getIP()!="UNKNOWN" || php_sapi_name()!=="cli") exit;
  40. if(system('test "`id -u`" -eq "0"',$retval)===false || $retval!=0) {
  41. echo "Must be run as root\n";
  42. exit;
  43. }
  44. ini_set('memory_limit','600M');
  45. ini_set('output_buffering','off');
  46. ini_set('implicit_flush','on');
  47. @ob_end_flush();
  48. echo "max memory set to " . ini_get('memory_limit'). "\n";
  49. $tmpdir = getenv("TMP");
  50. if($tmpdir=="") $tmpdir = getenv("TMPDIR");
  51. if($tmpdir[0] != '/') $tmdir = "/tmp";
  52. if($tmpdir=="") $tmpdir = "/tmp";
  53. $basdir=$ds;
  54. if(file_exists($ds . 'bocajail' . $tmpdir)) {
  55. $tmpdir=$ds . 'bocajail' . $tmpdir;
  56. $basdir=$ds . 'bocajail' . $ds;
  57. echo "bocajail environment seems to exist - trying to use it\n";
  58. } else {
  59. echo "bocajail not found - trying to proceed without using it\n";
  60. }
  61. if($ds=='/') {
  62. system("find $basdir -user bocajail -delete >/dev/null 2>/dev/null");
  63. system("find $basdir -user nobody -delete >/dev/null 2>/dev/null");
  64. system("find $basdir -group users -exec chgrp root '{}' \\; 2>/dev/null");
  65. system("find $basdir -perm /1002 -type d > /tmp/boca.writabledirs.tmp 2>/dev/null");
  66. system('chmod 400 /tmp/boca.writabledirs.tmp 2>/dev/null');
  67. }
  68. umask(0022);
  69. $cache = $tmpdir . $ds . "bocacache.d";
  70. cleardir($cache);
  71. @mkdir($cache);
  72. $key=md5(mt_rand() . rand() . mt_rand());
  73. $cf = globalconf();
  74. $ip = $cf["ip"];
  75. $activecontest=DBGetActiveContest();
  76. $prevsleep=0;
  77. //$dodebug=1;
  78. while(42) {
  79. if(($run = DBGetRunToAutojudging($activecontest["contestnumber"], $ip)) === false) {
  80. if($prevsleep==0)
  81. echo "Nothing to do. Sleeping...";
  82. else
  83. echo ".";
  84. flush();
  85. sleep(10);
  86. $prevsleep=1;
  87. continue;
  88. }
  89. if(!isset($dodebug)) {
  90. if(isset($dir)) cleardir($dir);
  91. if(isset($name)) unlink($name);
  92. }
  93. echo "\n";
  94. flush();
  95. $prevsleep=0;
  96. $number=$run["number"];
  97. $site=$run["site"];
  98. $contest=$run["contest"];
  99. echo "Removing possible files from previous runs\n";
  100. $dirs=file('/tmp/boca.writabledirs.tmp');
  101. for($dir=0;$dir<count($dirs);$dir++) {
  102. $dirn=trim($dirs[$dir]) . $ds;
  103. if($dirn[0] != '/') continue;
  104. system("find \"$dirn\" -user bocajail -delete >/dev/null 2>/dev/null");
  105. system("find \"$dirn\" -user nobody -delete >/dev/null 2>/dev/null");
  106. }
  107. echo "Entering directory $tmpdir (contest=$contest, site=$site, run=$number)\n";
  108. chdir($tmpdir);
  109. for($i=0; $i<5; $i++) {
  110. $name = tempnam($tmpdir, "boca");
  111. $dir = $name . ".d";
  112. if(@mkdir($dir, 0755)) break;
  113. @unlink($name);
  114. @rmdir($dir);
  115. }
  116. if($i>=5) {
  117. echo "It was not possible to create a unique temporary directory\n";
  118. LogLevel("Autojuging: Unable to create temp directory (run=$number, site=$site, contest=$contest)",1);
  119. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem creating temp directory");
  120. continue;
  121. }
  122. chdir($dir);
  123. echo "Using directory $dir (contest=$contest, site=$site, run=$number)\n";
  124. if($run["sourceoid"]=="" || $run["sourcename"]=="") {
  125. LogLevel("Autojuging: Source file not defined (run=$number, site=$site, contest=$contest)",1);
  126. echo "Source file not defined (contest=$contest, site=$site, run=$number)\n";
  127. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: source file not defined");
  128. continue;
  129. }
  130. if($run["inputoid"]=="" || $run["inputname"]=="") {
  131. LogLevel("Autojuging: problem package not defined (run=$number, site=$site, contest=$contest)",1);
  132. echo "Package file not defined (contest=$contest, site=$site, run=$number)\n";
  133. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file not defined");
  134. continue;
  135. }
  136. $c = DBConnect();
  137. DBExec($c, "begin work", "Autojudging(exporttransaction)");
  138. if(DB_lo_export($contest,$c, $run["sourceoid"], $dir . $ds . $run["sourcename"]) === false) {
  139. DBExec($c, "rollback work", "Autojudging(rollback-source)");
  140. LogLevel("Autojudging: Unable to export source file (run=$number, site=$site, contest=$contest)",1);
  141. echo "Error exporting source file ${run["sourcename"]} (contest=$contest, site=$site, run=$number)\n";
  142. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: unable to export source file");
  143. DBExec($c, "commit", "Autojudging(exportcommit)");
  144. continue;
  145. }
  146. if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
  147. DBExec($c, "commit", "Autojudging(exportcommit)");
  148. echo "Getting problem package file from local cache: " . $cache . $ds . $run["inputoid"] . "." . $run["inputname"] . "\n";
  149. $s = file_get_contents($cache . $ds . $run["inputoid"] . "." . $run["inputname"]);
  150. file_put_contents($dir . $ds . $run["inputname"], decryptData($s,$key));
  151. $basename=$basenames[$run['inputoid']. "." . $run["inputname"]];
  152. } else {
  153. echo "Downloading problem package file from db into: " . $dir . $ds . $run["inputname"] . "\n";
  154. if(DB_lo_export($contest,$c, $run["inputoid"], $dir . $ds . $run["inputname"]) === false) {
  155. DBExec($c, "rollback work", "Autojudging(rollback-input)");
  156. LogLevel("Autojudging: Unable to export problem package file (run=$number, site=$site, contest=$contest)",1);
  157. echo "Error exporting problem package file ${run["inputname"]} (contest=$contest, site=$site, run=$number)\n";
  158. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: unable to export problem package file");
  159. DBExec($c, "commit", "Autojudging(exportcommit)");
  160. continue;
  161. }
  162. DBExec($c, "commit", "Autojudging(exportcommit)");
  163. echo "Problem package downloaded -- running init scripts to obtain limits and other information\n";
  164. $zip = new ZipArchive;
  165. if ($zip->open($dir . $ds . $run["inputname"]) === true) {
  166. $zip->extractTo($dir . $ds . "problemdata");
  167. $zip->close();
  168. } else {
  169. echo "Failed to unzip the package file -- please check the problem package (maybe it is encrypted?)\n";
  170. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  171. cleardir($dir . $ds . "problemdata");
  172. continue;
  173. }
  174. if(($info=@parse_ini_file($dir . $ds . "problemdata" . $ds . "description" . $ds . 'problem.info'))===false) {
  175. echo "Problem content missing (description/problem.info) -- please check the problem package\n";
  176. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is incomplete");
  177. cleardir($dir . $ds . "problemdata");
  178. continue;
  179. }
  180. $descfile=trim(sanitizeText($info['descfile']));
  181. $basename=trim(sanitizeText($info['basename']));
  182. $fullname=trim(sanitizeText($info['fullname']));
  183. if($basename=='') {
  184. echo "Problem content missing (description/problem.info) -- please check the problem package\n";
  185. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  186. cleardir($dir . $ds . "problemdata");
  187. continue;
  188. }
  189. $basenames[$run['inputoid']. "." . $run["inputname"]]=$basename;
  190. if(!is_dir($dir . $ds . "problemdata" . $ds . "limits")) {
  191. echo "Problem content missing (limits) -- please check the problem package\n";
  192. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  193. cleardir($dir . $ds . "problemdata");
  194. continue;
  195. }
  196. chdir($dir . $ds . "problemdata" . $ds . "limits");
  197. $limits[$basename]=array();
  198. foreach(glob($dir . $ds . "problemdata" . $ds . "limits" .$ds . '*') as $file) {
  199. chmod($file,0700);
  200. $ex = escapeshellcmd($file);
  201. $ex .= " >stdout 2>stderr";
  202. echo "Executing INIT SCRIPT " . $ex . " at " . getcwd() . "\n";
  203. if(system($ex, $retval)===false) $retval=-1;
  204. if($retval != 0) {
  205. echo "Error running script -- please check the problem package\n";
  206. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  207. cleardir($dir . $ds . "problemdata");
  208. continue;
  209. }
  210. $limits[$basename][basename($file)] = file('stdout',FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  211. }
  212. $cont=false;
  213. foreach(glob($dir . $ds . "problemdata" . $ds . "tests" .$ds . '*') as $file) {
  214. chdir($dir . $ds . "problemdata" . $ds . "tests");
  215. chmod($file,0700);
  216. $ex = escapeshellcmd($file);
  217. $ex .= " >stdout 2>stderr";
  218. echo "Executing TEST SCRIPT " . $ex . " at " . getcwd() . "\n";
  219. if(system($ex, $retval)===false) $retval=-1;
  220. if($retval != 0) {
  221. echo "Error running test script -- please check the problem package\n";
  222. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: internal test script failed");
  223. $cont=true;
  224. break;
  225. }
  226. }
  227. cleardir($dir . $ds . "problemdata");
  228. if($cont)
  229. continue;
  230. $s = file_get_contents($dir . $ds . $run["inputname"]);
  231. file_put_contents($cache . $ds . $run["inputoid"] . "." . $run["inputname"], encryptData($s,$key));
  232. }
  233. if(!isset($limits[$basename][$run["extension"]][0]) || !is_numeric($limits[$basename][$run["extension"]][0]) ||
  234. !isset($limits[$basename][$run["extension"]][1]) || !is_numeric($limits[$basename][$run["extension"]][1]) ||
  235. !isset($limits[$basename][$run["extension"]][2]) || !is_numeric($limits[$basename][$run["extension"]][2]) ||
  236. !isset($limits[$basename][$run["extension"]][3]) || !is_numeric($limits[$basename][$run["extension"]][3]) ) {
  237. echo "Failed to find proper limits information for the problem -- please check the problem package\n";
  238. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  239. continue;
  240. }
  241. // COMPILATION
  242. //# parameters are:
  243. //# $1 source_file
  244. //# $2 exe_file (default ../run.exe)
  245. //# $3 timelimit (optional, limit to run all the repetitions, by default only one repetition)
  246. //# $4 maximum allowed memory (in MBytes)
  247. $zip = new ZipArchive;
  248. if ($zip->open($dir . $ds . $run["inputname"]) === true) {
  249. $zip->extractTo($dir, array("compile" . $ds . $run["extension"]));
  250. $zip->close();
  251. } else {
  252. echo "Failed to unzip the package file -- please check the problem package\n";
  253. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  254. continue;
  255. }
  256. $script = $dir . $ds . 'compile' . $ds . $run["extension"];
  257. if(!is_file($script)) {
  258. echo "Error (not found) compile script for ".$run["extension"]." -- please check the problem package\n";
  259. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: compile script failed (".$run["extension"].")");
  260. continue;
  261. }
  262. chdir($dir);
  263. @unlink('allout');
  264. system('touch allout');
  265. @unlink('allerr');
  266. system('touch allerr');
  267. chmod($script, 0700);
  268. $ex = escapeshellcmd($script) ." ".
  269. escapeshellarg($run["sourcename"])." ".
  270. escapeshellarg($basename) . " ".
  271. escapeshellarg(trim($limits[$basename][$run["extension"]][0]))." ".
  272. escapeshellarg(trim($limits[$basename][$run["extension"]][2]));
  273. $ex .= " >stdout 2>stderr";
  274. echo "Executing " . $ex . " at " . getcwd() . "\n";
  275. if(system($ex, $retval)===false) $retval=-1;
  276. if(is_readable('stdout')) {
  277. system('echo ##### COMPILATION STDOUT: >> allerr');
  278. system('cat stdout >> allerr');
  279. }
  280. if(is_readable('stderr')) {
  281. system('echo ##### COMPILATION STDERR: >> allerr');
  282. system('cat stderr >> allerr');
  283. }
  284. if($retval != 0) {
  285. list($retval,$answer) = exitmsg($retval);
  286. $answer = "(WHILE COMPILING) " . $answer;
  287. } else {
  288. //# parameters are:
  289. //# $1 exe_file
  290. //# $2 input_file
  291. //# $3 timelimit (limit to run all the repetitions, by default only one repetition)
  292. //# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
  293. //# $5 maximum allowed memory (in MBytes)
  294. //# $6 maximum allowed output size (in KBytes)
  295. $zip = new ZipArchive;
  296. $inputlist = array();
  297. $ninputlist = 0;
  298. $outputlist = array();
  299. $noutputlist = 0;
  300. if ($zip->open($dir . $ds . $run["inputname"]) === true) {
  301. for($i = 0; $i < $zip->numFiles; $i++) {
  302. $filename = $zip->getNameIndex($i);
  303. $pos = strrpos(dirname($filename),"input");
  304. if($pos !== false && $pos==strlen(dirname($filename))-5) {
  305. $inputlist[$ninputlist++] = 'input' . $ds . basename($filename);
  306. $outputlist[$noutputlist++] = 'output' . $ds . basename($filename,'.link');
  307. }
  308. }
  309. $zip->extractTo($dir, array_merge(array("run" . $ds . $run["extension"]),$inputlist));
  310. $zip->close();
  311. } else {
  312. echo "Failed to unzip the file (inputs) -- please check the problem package\n";
  313. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  314. continue;
  315. }
  316. $retval = 0;
  317. $script = $dir . $ds . 'run' . $ds . $run["extension"];
  318. if(!is_file($script)) {
  319. echo "Failed to unzip the run script -- please check the problem package\n";
  320. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  321. continue;
  322. }
  323. chmod($script, 0700);
  324. mkdir('team', 0755);
  325. if($ninputlist == 0) {
  326. echo "Failed to read input files from ZIP -- please check the problem package\n";
  327. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  328. continue;
  329. } else {
  330. $errp=0;
  331. foreach($inputlist as $file) {
  332. $file = basename($file);
  333. if(is_file($dir . $ds . "input" . $ds . $file)) {
  334. $file1=basename($file,'.link');
  335. if($file != $file1) {
  336. $fnam = trim(file_get_contents($dir . $ds . "input" . $ds . $file));
  337. echo "Input file $file is a link. Trying to read the linked file: ($fnam)\n";
  338. if(is_readable($fnam)) {
  339. @unlink($dir . $ds . "input" . $ds . $file);
  340. $file = basename($file,".link");
  341. @copy($fnam,$dir . $ds . "input" . $ds . $file);
  342. } else {
  343. echo "Failed to read input files from link indicated in the ZIP -- please check the problem package\n";
  344. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid or missing files on the autojudge");
  345. $errp=1; break;
  346. }
  347. }
  348. $ex = escapeshellcmd($script) ." ".
  349. escapeshellarg($basename) . " ".
  350. escapeshellarg($dir . $ds . "input" . $ds . $file)." ".
  351. escapeshellarg(trim($limits[$basename][$run["extension"]][0]))." ".
  352. escapeshellarg(trim($limits[$basename][$run["extension"]][1]))." ".
  353. escapeshellarg(trim($limits[$basename][$run["extension"]][2]))." ".
  354. escapeshellarg(trim($limits[$basename][$run["extension"]][3]));
  355. $ex .= " >stdout 2>stderr";
  356. echo "Executing " . $ex . " at " . getcwd() . " for input " . $file . "\n";
  357. if(system($ex, $retval)===false) $retval=-1;
  358. foreach (glob($dir . $ds . '*') as $fne) {
  359. @chown($fne,"nobody");
  360. @chmod($fne,0755);
  361. }
  362. if(is_readable('stderr0'))
  363. system('cat stderr0 >> stderr');
  364. system('echo ##### STDERR FOR FILE ' . escapeshellarg($file) . ' >> allerr');
  365. system('cat stderr >> allerr');
  366. system('cat stdout > team' . $ds . escapeshellarg($file));
  367. system('echo ##### STDOUT FOR FILE ' . escapeshellarg($file) . ' >> allout');
  368. system('cat stdout >> allout');
  369. if($retval != 0) {
  370. list($retval,$answer) = exitmsg($retval);
  371. $answer = "(WHILE RUNNING) " . $answer;
  372. break;
  373. }
  374. } else {
  375. echo "==> ERROR reading input file " . $dir . $ds . "input" . $ds . $file . " - skipping it!\n";
  376. }
  377. }
  378. if($errp==1) continue;
  379. }
  380. if($retval==0) {
  381. echo "Processing results\n";
  382. $zip = new ZipArchive;
  383. if ($zip->open($dir . $ds . $run["inputname"]) === true) {
  384. $zip->extractTo($dir, array_merge(array("compare" . $ds . $run["extension"]),$outputlist));
  385. $zip->close();
  386. } else {
  387. echo "Failed to unzip the file (outputs) -- please check the problem package\n";
  388. DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid");
  389. continue;
  390. }
  391. $script = $dir . $ds . 'compare' . $ds . $run["extension"];
  392. $retval = 0;
  393. chmod($script, 0700);
  394. foreach($outputlist as $file) {
  395. $file = basename($file);
  396. if(is_file($dir . $ds . 'output' . $ds . $file)) {
  397. $ex = escapeshellcmd($script) ." ".
  398. escapeshellarg($dir . $ds . "team" . $ds . $file)." ".
  399. escapeshellarg($dir . $ds . "output" . $ds . $file)." ".
  400. escapeshellarg($dir . $ds . "input" . $ds . $file) . " >compout";
  401. echo "Executing " . $ex . " at " . getcwd() . " for output file $file\n";
  402. $answer = system($ex, $localretval);
  403. $fp = fopen($dir . $ds . "allerr", "a+");
  404. fwrite($fp, "\n\n===OUTPUT OF COMPARING SCRIPT FOLLOWS FOR FILE " .$file ." (EMPTY MEANS NO DIFF)===\n");
  405. $dif = file($dir . $ds . "compout");
  406. $difi = 0;
  407. for(; $difi < count($dif)-1 && $difi < 5000; $difi++)
  408. fwrite($fp, $dif[$difi]);
  409. if($difi >= 5000) fwrite($fp, "===OUTPUT OF COMPARING SCRIPT TOO LONG - TRUNCATED===\n");
  410. else fwrite($fp, "===OUTPUT OF COMPARING SCRIPT ENDS HERE===\n");
  411. $answer = trim($dif[count($dif)-1]);
  412. fclose($fp);
  413. foreach (glob($dir . $ds . '*') as $fne) {
  414. @chown($fne,"nobody");
  415. @chmod($fne,0755);
  416. }
  417. // retval 5 (presentation) and retval 6 (wronganswer) are already compatible with the compare script
  418. if($localretval < 4 || $localretval > 6) {
  419. // contact staff
  420. $retval = 7;
  421. $answer='Contact staff';
  422. }
  423. else if($retval==0) {
  424. if($localretval==4) {
  425. // YES!
  426. $answer='YES';
  427. $retval = 1;
  428. } else $retval=$localretval;
  429. }
  430. else if($retval==1) {
  431. if($localretval!=4) {
  432. $retval=$localretval;
  433. $answer='Presentation error';
  434. }
  435. }
  436. } else {
  437. echo "==> ERROR reading output file " . $dir . $ds . 'output' . $ds . $file . " - skipping it!\n";
  438. }
  439. }
  440. }
  441. }
  442. if($retval > 9) {
  443. $ans = file("allout");
  444. $anstmp = trim(escape_string($ans[count($ans)-1]));
  445. unset($ans);
  446. LogLevel("Autojudging: Script returned unusual code: $retval ($anstmp)".
  447. "(run=$number, site=$site, contest=$contest)",1);
  448. echo "Autojudging script returned unusual code $retval ($anstmp)".
  449. "(contest=$contest, site=$site, run=$number)\n";
  450. $answer = "(check output files - unusual code: $retval) " . $anstmp;
  451. // contact staff
  452. $retval = 7;
  453. }
  454. echo "Sending results to server...\n";
  455. //echo "out==> "; system("tail -n1 ". $dir.$ds.'allout');
  456. //echo "err==> "; system("tail -n1 ". $dir.$ds.'allerr');
  457. DBUpdateRunAutojudging($contest, $site, $number, $ip, $answer, $dir.$ds.'allout', $dir.$ds.'allerr', $retval);
  458. LogLevel("Autojudging: answered '$answer' (run=$number, site=$site, contest=$contest)",3);
  459. echo "Autojudging answered '$answer' (contest=$contest, site=$site, run=$number)\n";
  460. }
  461. ?>