-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexport_contest_code.php
More file actions
29 lines (28 loc) · 1.17 KB
/
export_contest_code.php
File metadata and controls
29 lines (28 loc) · 1.17 KB
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
<?php
@session_start();
ini_set("display_errors","Off");
if (!isset($_SESSION['user_id'])){
$view_errors= "<a href=./loginpage.php>Please LogIn First!</a>";
exit(0);
}
$contest_id=intval($_GET['cid']);
if (!(isset($_SESSION['m'.$contest_id])||isset($_SESSION['administrator']))){
$view_errors= "<a href=./loginpage.php>No privileges!</a>";
exit(0);
}
header ( "content-type: application/file" );
header ( "content-disposition: attachment; filename=\"logs-$contest_id.txt\"" );
require_once('./include/db_info.inc.php');
$sql="select user_id,problem_id,result,source from source_code right join
(select solution_id,problem_id,user_id,result from solution where contest_id='".$contest_id."' ) S
on source_code.solution_id=S.solution_id order by S.solution_id";
require_once("./include/const.inc.php");
#echo $sql;
$result=mysql_query($sql);
while($row=mysql_fetch_object($result)){
echo "$row->user_id:Problem".$row->problem_id.":".$judge_result[$row->result];
echo "\r\n$row->source";
echo "\r\n------------------------------------------------------\r\n";
}
mysql_free_result($result);
?>