-
Notifications
You must be signed in to change notification settings - Fork 17
/
videoinfo.php
57 lines (54 loc) · 1.55 KB
/
videoinfo.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
<?php
$vid=@$_GET['id'];
require_once(dirname(__FILE__).'/utils/video.php');
require_once(dirname(__FILE__).'/utils/common.php');
require_once(dirname(__FILE__).'/utils/access.php');
if(!isIntStr($vid)){
http_response_code(404);
exit;
}
$videoOpt=new Video();
try{
$videoInfo=$videoOpt->videoInfo($vid,'title,playCount,cover,V.description AS description,danmakuCount',Access::hasLoggedIn());
if(!$videoInfo){
http_response_code(404);
exit;
}
foreach ($videoInfo as $key => $value) {
if(is_null($videoInfo->$key))$videoInfo->$key='';
}
}catch(Exception $e){
http_response_code(500);
echo 'Error<BR>';
require_once(dirname(__FILE__).'/utils/access.php');
if(Access::hasLoggedIn()){
echo '<pre>';
var_dump($e);
echo '</pre>';
}
exit;
}
?>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script src='<?php pModTime('static/api.js');?>'></script>
<link rel="stylesheet" type="text/css" href="<?php pModTime('static/videoInfo.css');?>">
</head>
<body>
<h1 id="title"></h1>
<div id="info">
<div id="count">
<span id="playCount"></span> <span id="danmakuCount"></span>
</div>
<span id="desc"></span>
</div>
<div>
<a id="play" target="_self" href="<?php echo 'player/?id='.$vid;?>">播放</a>
</div>
</body>
<script>var info=JSON.parse(base64.decode('<?php echo base64_encode(json_encode($videoInfo,JSON_UNESCAPED_UNICODE));?>'));</script>
<script src="<?php pModTime('static/videoInfo.js');?>"></script>
</html>