-
Notifications
You must be signed in to change notification settings - Fork 0
/
reinfo.php
executable file
·60 lines (52 loc) · 1.67 KB
/
reinfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
$cache_time=10;
$OJ_CACHE_SHARE=false;
require_once('./include/cache_start.php');
require_once('./include/db_info.inc.php');
require_once('./include/setlang.php');
$view_title= "Welcome To Online Judge";
require_once("./include/const.inc.php");
if (!isset($_GET['sid'])){
echo "No such code!\n";
require_once("oj-footer.php");
exit(0);
}
function is_valid($str2){
$n=strlen($str2);
$str=str_split($str2);
$m=1;
for($i=0;$i<$n;$i++){
if(is_numeric($str[$i])) $m++;
}
return $n/$m>3;
}
$ok=false;
$id=strval(intval($_GET['sid']));
$sql="SELECT * FROM `solution` WHERE `solution_id`='".$id."'";
$result=mysql_query($sql);
$row=mysql_fetch_object($result);
if ($row && $row->user_id==$_SESSION['user_id']) $ok=true;
if (isset($_SESSION['source_browser'])) $ok=true;
$view_reinfo="";
if ($ok==true){
if($row->user_id!=$_SESSION['user_id'])
$view_mail_link= "<a href='mail.php?to_user=$row->user_id&title=$MSG_SUBMIT $id'>Mail the auther</a>";
mysql_free_result($result);
$sql="SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='".$id."'";
$result=mysql_query($sql);
$row=mysql_fetch_object($result);
if($row&&($OJ_SHOW_DIFF||$OJ_TEST_RUN||is_valid($row->error)))
$view_reinfo= htmlspecialchars(str_replace("\n\r","\n",$row->error));
mysql_free_result($result);
}else{
mysql_free_result($result);
$view_errors= "I am sorry, You could not view this message!";
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}
/////////////////////////Template
require("template/".$OJ_TEMPLATE."/reinfo.php");
/////////////////////////Common foot
if(file_exists('./include/cache_end.php'))
require_once('./include/cache_end.php');
?>