-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin_run_rejudge.php
50 lines (44 loc) · 1.4 KB
/
admin_run_rejudge.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
include("conn.php");
$runid = convert_str($_GET['runid']);
if ($runid=="") {
echo "Unable to rejudge.";
die();
}
$sql="select pid,result,contest_belong from status where runid='$runid'";
$que = mysql_query($sql);
if (!$que) {
echo "Unable to rejudge.";
die();
}
list($pid,$result,$cid)=mysql_fetch_array($que);
if (!db_user_match($nowuser,$nowpass)||!db_user_isroot($nowuser)) {
echo "Not Allowed.";
die();
}
$ispretest=true;
if ($cid=="0"||!db_contest_has_cha($cid)||db_contest_passed($cid)) $ispretest=false;
$host="localhost";
/*if (db_problem_isvirtual($pid))*/ $port=$vserver_port;
/*else {
echo "Unable to rejudge.";
die();
}*/
list($vname)=@mysql_fetch_array(mysql_query("select vname from problem where pid=$pid"));
$sql_r = "update status set result='Rejudging' where runid='$runid' ";
$que_r = mysql_query($sql_r);
$fp = fsockopen($host,$port,$errno, $errstr);
if (!$fp) {
echo "<br>$errno ($srrstr) </br>\n";
}
else {
if (!$ispretest) $msg=$reerrorstring."\n".$runid."\n".$vname;
else $msg=$pretest_string."\n".$runid."\n".$vname;
if (fwrite($fp,$msg)===FALSE) {
echo "<br>can not send msg</br>";
exit;
}
fclose($fp);
}
echo $runid." has been sent to Rejudge.";
?>