-
Notifications
You must be signed in to change notification settings - Fork 70
/
file_download.php
47 lines (44 loc) · 1.29 KB
/
file_download.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
<?php
/**
* 下载文件
* @author fotomxq <fotomxq.me>
* @version 1
* @package oa
*/
/**
* 引入用户登陆检测模块(包含全局引用)
* @since 1
*/
require('logged.php');
/**
* 引入post类并创建实例
* @since 1
*/
require(DIR_LIB . DS . 'oa-post.php');
$oapost = new oapost($db, $ip_arr['id']);
/**
* 下载文件
* @since 1
*/
if (isset($_GET['id']) == true) {
$download_view = $oapost->view($_GET['id']);
if ($download_view) {
//判断密码是否匹配
$download_password_boolean = false;
if ($download_view['post_password']) {
if ($_GET['pw'] === $download_view['post_password']) {
$download_password_boolean = true;
}
} else {
$download_password_boolean = true;
}
if ($download_password_boolean == true) {
$download_parent_view = $oapost->view($download_view['post_parent']);
$download_dir = substr($download_parent_view['post_date'], 0, 4) . substr($download_parent_view['post_date'], 5, 2) . '/' . substr($download_parent_view['post_date'], 8, 2);
plugtourl($website_url . '/' . DIR_DATA . '/files/' . $download_dir . '/' . $download_parent_view['post_name']);
} else {
plugerror('downloadfile-pw');
}
}
}
?>