diff --git a/trunk/web/submit.php b/trunk/web/submit.php index 18e13f29a48..98b5c0f5d83 100644 --- a/trunk/web/submit.php +++ b/trunk/web/submit.php @@ -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."
"; + require "template/" . $OJ_TEMPLATE . "/error.php"; + exit(0); + } $source=file_get_contents($tempfile); $len = strlen($source); unlink($tempfile); @@ -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."
"; + require "template/".$OJ_TEMPLATE."/error.php"; + exit(0); +} +if ($len > 65536) { + $view_errors = $MSG_TOO_LONG."
"; + require "template/" . $OJ_TEMPLATE . "/error.php"; + exit(0); +} + setcookie('lastlang', $language, time()+360000); @@ -269,17 +284,6 @@ } -if ($len < 2) { - $view_errors = $MSG_TOO_SHORT.$tempfile."
"; - require "template/".$OJ_TEMPLATE."/error.php"; - exit(0); -} - -if ($len > 65536) { - $view_errors = $MSG_TOO_LONG."
"; - require "template/" . $OJ_TEMPLATE . "/error.php"; - exit(0); -} if (!$OJ_BENCHMARK_MODE) { // last submit