Skip to content

Commit

Permalink
Return runid
Browse files Browse the repository at this point in the history
  • Loading branch information
crccw committed Jul 23, 2016
1 parent 39ba65b commit 980a685
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
3 changes: 3 additions & 0 deletions ajax/contest_problem_submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
$query="update user set total_submit=total_submit+1 where username='$uname' ";
$result = $db->query($query);

$ret = array(
"runid" => $nowid
);
$host=$config["contact"]["server"];
$port=$config["contact"]["port"];
$fp = @fsockopen($host,$port,$errno, $errstr);
Expand Down
23 changes: 8 additions & 15 deletions ajax/problem_submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,21 @@
$query="update user set total_submit=total_submit+1 where username='$uname' ";
$result = $db->query($query);

$ret = array(
"msg" => "Submitted.",
"code" => 0,
"runid" => $nowid
);

$host=$config["contact"]["server"];
$port=$config["contact"]["port"];
$fp = @fsockopen($host,$port,$errno, $errstr);
if (!$fp) {
$ret["msg"]="Submitted.";
$ret["code"]=0;
echo json_encode($ret);
die();
}
else {
if ($fp) {
$msg=$config["contact"]["submit"]."\n".$nowid;
$msg=$msg."\n".$vname;
if (@fwrite($fp,$msg)===FALSE) {
$ret["msg"]="Submitted.";
$ret["code"]=0;
echo json_encode($ret);
die();
}
@fwrite($fp,$msg);
fclose($fp);
}
$ret["msg"]="Submitted.";
$ret["code"]=0;
echo json_encode($ret);

?>

0 comments on commit 980a685

Please sign in to comment.