1 Star 0 Fork 0

岳小威子 / space

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 2.68 KB
一键复制 编辑 原始数据 按行查看 历史
alan.yue 提交于 2021-03-21 14:34 . test
<?php
include('config.php');
error_reporting(0);
$f = str_replace("//", "/", $_GET['f']);
if (!is_dir($path . $f)) {
if (file_exists($path . $f)) {
include('download.php');
exit;
} else {
include('404.php');
exit;
}
}
if (empty($f)) $page_title = 'Index of /';
else $page_title = 'Index of ' . $f;
include('header.php');
?>
<div class="mdui-container doc-container">
<div class="mdui-typo">
<h2 class="doc-chapter-title doc-chapter-title-first mdui-text-color-theme"><?php echo $page_title ?><a
class="doc-anchor" id="font"></a></h2>
</div>
</div>
<br>
<div class="mdui-container">
<div class="mdui-typo mdui-table-fluid">
<table class="mdui-table mdui-table-hoverable">
<thead>
<tr>
<th>文件名</th>
<th>文件大小</th>
<th>修改日期</th>
</tr>
</thead>
<tbody>
<?php
if (dirname($f) == '/') $p = '';
else $p = dirname($f);
if ($rewrite) echo '<td><a href="' . get_info('site_url') . $p . '">上级目录</a></td>';
else echo '<td><a href="' . get_info('site_url') . '?f=' . $p . '">上级目录</a></td>';
echo '<td>Dir</td><td>' . date("Y-m-d H:i:s", filemtime($path . $f)) . '</td>';
if (is_dir($path . $f)) {
$dir = scandir($path . $f);
foreach ($dir as $value) {
$sub_path = $path . $f . '/' . $value;
if ($value == '.' || $value == '..') {
continue;
} else {
echo '<tr>';
if (is_dir($sub_path)) {
$download_p = '';
$size = 'Dir';
} else {
$download_p = 'download="' . $value . '"';
$size = size_unit(filesize($sub_path));
}
if ($rewrite) echo '<td><a href="' . get_info('site_url') . str_replace("//", "/", $f . '/' . $value) . '" ' . $download_p . '>' . $value . '</a></td>';
else echo '<td><a href="' . get_info('site_url') . '?f=' . str_replace("//", "/", $f . '/' . $value) . '" ' . $download_p . '>' . $value . '</a></td>';
echo '<td>' . $size . '</td>';
echo '<td>' . date("Y-m-d H:i:s", filemtime($sub_path)) . '</td>';
echo '</tr>';
}
}
}
?>
</tbody>
</table>
</div>
<br>
</div>
</body>
</html>
PHP
1
https://gitee.com/alan-yuewei/space.git
git@gitee.com:alan-yuewei/space.git
alan-yuewei
space
space
master

搜索帮助