forked from Ginakira/JMSUOJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
balloon_view.php
executable file
·50 lines (45 loc) · 1.5 KB
/
balloon_view.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
<?php
$cache_time = 90;
$OJ_CACHE_SHARE = false;
require_once('./include/cache_start.php');
require_once('./include/db_info.inc.php');
require_once('./include/setlang.php');
$view_title = "Source Code";
require_once("./include/const.inc.php");
if (!isset($_GET['id'])) {
$view_errors = "No such code!\n";
require("template/" . $OJ_TEMPLATE . "/error.php");
require "oj-footer.php";
exit(0);
}
if (!isset($_SESSION[$OJ_NAME . '_' . 'balloon'])) {
$view_errors = "Not privileged!\n";
require("template/" . $OJ_TEMPLATE . "/error.php");
require "oj-footer.php";
exit(0);
}
$id = strval(intval($_GET['id']));
$sql = "SELECT user_id,pid,cid FROM `balloon` WHERE `balloon_id`=?";
$result = pdo_query($sql, $id);
if ($row = $result[0]) {
$view_user = $row['user_id'];
$view_pid = $row['pid'];
$cid = $row['cid'];
$result = pdo_query("select * from users where user_id=?", $view_user);
if ($row = $result[0]) {
$view_nick = $row['nick'];
$view_school = $row['school'];
}
$map = pdo_query("select * from news where title=?", "SEAT$cid");
$view_map = "add map by adding news titled SEAT$cid";
if (count($map) == 1) {
$view_map = $map[0]['content'];
}
}
/////////////////////////Template
require "template/$OJ_TEMPLATE/balloon_view.php";
require "oj-footer.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php'))
require_once('./include/cache_end.php');
?>