0 ){
$sql="select start_time,end_time from contest where contest_id=?";
$result=pdo_query($sql,$contest_id);
if($result){
$row=$result[0];
$start_time = strtotime($row['start_time']);
$end_time = strtotime($row['end_time']);
$now=time();
if( $end_time < $now ){ // 当前提交,属于已经结束的比赛,考察是否有进行中的比赛在使用。
$need_check_using=true;
}else{ // 属于进行中的比赛,可以看
$need_check_using=false;
}
}
}else{ //非比赛提交.考察是否有进行中的比赛在使用
$need_check_using=true;
}
// 检查是否使用中
$now = date('Y-m-d H:i', time());
$sql="select contest_id from contest where contest_id in (select contest_id from contest_problem where problem_id=?)
and start_time < '$now' and end_time > '$now' ";
if($need_check_using){
//echo $sql;
$result=pdo_query($sql,$sproblem_id);
if(count($result)>0){
$view_errors = "
";
$view_errors .= "$MSG_CONTEST_ID : ".$result[0][0]."
";
$view_errors .= " $MSG_SOURCE_NOT_ALLOWED_FOR_EXAM
";
$view_errors .= "
";
$view_errors .= "";
$view_errors .= "
";
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}
}
}
if(isset($OJ_EXAM_CONTEST_ID)){
if($contest_id<$OJ_EXAM_CONTEST_ID&&!isset($_SESSION[$OJ_NAME.'_'.'source_browser'])){
$view_errors = "";
$view_errors .= "$MSG_CONTEST_ID : ".$OJ_EXAM_CONTEST_ID."+
";
$view_errors .= " $MSG_SOURCE_NOT_ALLOWED_FOR_EXAM
";
$view_errors .= "
";
$view_errors .= "";
$view_errors .= "
";
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}
}
if (isset($OJ_AUTO_SHARE)&&$OJ_AUTO_SHARE&&isset($_SESSION[$OJ_NAME.'_'.'user_id'])){
$sql="SELECT 1 FROM solution where
result=4 and problem_id=$sproblem_id and user_id=?";
$rrs=pdo_query($sql,$_SESSION[$OJ_NAME.'_'.'user_id']);
$ok=(count($rrs)>0);
}
$view_source="No source code available!";
if (isset($_SESSION[$OJ_NAME.'_'.'user_id'])&&$row && $owner==$_SESSION[$OJ_NAME.'_'.'user_id']) $ok=true;
if (isset($_SESSION[$OJ_NAME.'_'.'source_browser'])) $ok=true;
$sql="SELECT `source` FROM `source_code_user` WHERE `solution_id`=?";
$result=pdo_query($sql,$id);
$row=$result[0];
if($row)
$view_source=$row['source'];
/////////////////////////Template
require("template/".$OJ_TEMPLATE."/showsource2.php");
/////////////////////////Common foot
if(file_exists('./include/cache_end.php'))
require_once('./include/cache_end.php');
?>