Skip to content

Commit

Permalink
Update submit.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zhblue authored Nov 22, 2024
1 parent 54b7987 commit 4a0829b
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions trunk/web/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,14 @@
}

$tempfile = $_FILES ["answer"] ["tmp_name"];
$len=$_FILES['answer']['size'];
if($tempfile!=""){
if($language!=23){

if ($len > 65536) {
$view_errors = $MSG_TOO_LONG."<br>";
require "template/" . $OJ_TEMPLATE . "/error.php";
exit(0);
}
$source=file_get_contents($tempfile);
$len = strlen($source);
unlink($tempfile);
Expand Down Expand Up @@ -255,8 +260,18 @@
$id = 0;
}

if($language!=23) $len = strlen($source);else $len = $_FILES['answer']['size'];
//echo $source;
if($language!=23) $len = strlen($source); else $len = $_FILES['answer']['size'];
if ($len < 2) {
$view_errors = $MSG_TOO_SHORT.$tempfile."<br>";
require "template/".$OJ_TEMPLATE."/error.php";
exit(0);
}
if ($len > 65536) {
$view_errors = $MSG_TOO_LONG."<br>";
require "template/" . $OJ_TEMPLATE . "/error.php";
exit(0);
}


setcookie('lastlang', $language, time()+360000);

Expand All @@ -269,17 +284,6 @@
}


if ($len < 2) {
$view_errors = $MSG_TOO_SHORT.$tempfile."<br>";
require "template/".$OJ_TEMPLATE."/error.php";
exit(0);
}

if ($len > 65536) {
$view_errors = $MSG_TOO_LONG."<br>";
require "template/" . $OJ_TEMPLATE . "/error.php";
exit(0);
}

if (!$OJ_BENCHMARK_MODE) {
// last submit
Expand Down

0 comments on commit 4a0829b

Please sign in to comment.