Beispiel #1
0
function DBRunDelete($number, $site, $contest, $user, $usersite)
{
    $c = DBConnect();
    DBExec($c, "begin work", "DBRunDelete(transaction)");
    $sql = "select * from runtable as r where r.contestnumber={$contest} and " . "r.runsitenumber={$site} and r.runnumber={$number}";
    $r = DBExec($c, $sql . " for update", "DBRunDelete(get run for update)");
    $n = DBnlines($r);
    if ($n != 1) {
        DBExec($c, "rollback work", "DBRunDelete(rollback)");
        LogLevel("Unable to delete a run. " . "(run={$number}, site={$site}, contest={$contest})", 1);
        return false;
    }
    $temp = DBRow($r, 0);
    $tinhabalao = DBBalloon($contest, $site, $temp["usernumber"], $temp["runproblem"], true, $c);
    DBExec($c, "update runtable set runstatus='deleted', runjudge={$user}, runjudgesite={$usersite}, updatetime=" . time() . " where contestnumber={$contest} and runnumber={$number} and runsitenumber={$site}", "DBRunDelete(update run)");
    $tembalao = DBBalloon($contest, $site, $temp["usernumber"], $temp["runproblem"], true, $c);
    if ($tinhabalao && !$tembalao) {
        $u = DBUserInfo($contest, $site, $temp["usernumber"], $c);
        if ($u['usertype'] == 'team') {
            $p = DBGetProblemData($contest, $temp["runproblem"], $c);
            DBNewTask_old($contest, $site, $temp["usernumber"], escape_string("\"" . $u["username"] . "\" must have _NO_ balloon for problem " . $p[0]["problemname"] . ": " . $p[0]["fullname"]), "", "", "t", $p[0]["color"], $p[0]["colorname"], $c);
        }
    }
    DBExec($c, "commit work", "DBRunDelete(commit)");
    LOGLevel("Run deleted (run={$number}, site={$site}, contest={$contest}, user={$user}(site={$usersite})).", 3);
    return true;
}
Beispiel #2
0
        DBUpdateRun($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"], $sitenumber, $number, $answer);
        //, $notuser, $updscore);
    }
    ForceLoad("run.php");
}
if (!isset($_GET["runnumber"]) || !isset($_GET["runsitenumber"]) || !is_numeric($_GET["runnumber"]) || !is_numeric($_GET["runsitenumber"])) {
    IntrusionNotify("tried to open the judge/runedit.php with wrong parameters.");
    ForceLoad("run.php");
}
$runsitenumber = myhtmlspecialchars($_GET["runsitenumber"]);
$runnumber = myhtmlspecialchars($_GET["runnumber"]);
if (($a = DBGetRunToAnswer($runnumber, $runsitenumber, $_SESSION["usertable"]["contestnumber"])) === false) {
    MSGError("Another judge got it first.");
    ForceLoad("run.php");
}
$b = DBGetProblemData($_SESSION["usertable"]["contestnumber"], $a["problemnumber"]);
?>
<br><br><center><b>Use the following fields to judge the run:
</b></center>
<form name="form1" method="post" action="runedit.php">
  <input type=hidden name="confirmation" value="noconfirm" />
  <center>
    <table border="1">
      <tr> 
        <td width="27%" align=right><b>Site:</b></td>
        <td width="83%"> 
		<input type=hidden name="sitenumber" value="<?php 
echo $a["sitenumber"];
?>
" />
		<?php