-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlsfileTime.php
More file actions
134 lines (121 loc) · 3.17 KB
/
lsfileTime.php
File metadata and controls
134 lines (121 loc) · 3.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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
session_start();
// logo图片地址
$logo_url = "http://102.200.215.126/00_logo/list.png";
// 服务器根目录,通常位域名或者ip地址
$root_url = "http://102.200.215.126/";
// php文件名
$scriptname = "lsfileTime.php";
// 末尾公司名字
$company_name = "Your Company Name";
// If the user is not logged in, redirect to the login page
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header('Location: login.php');
exit;
}
// If the user clicked the logout link, log them out and redirect to the login page
if (isset($_GET['logout'])) {
session_destroy(); // destroy all session data
header('Location: login.php');
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="<?php echo $logo_url; ?>">
<title>List of Files</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
margin-top: 50px;
}
table {
border-collapse: collapse;
margin: auto;
width: 50%;
}
th, td {
padding: 10px;
border: 1px solid black;
}
th {
background-color: #ddd;
font-weight: bold;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
a {
text-decoration: none;
}
/*下面的main,footer是有关logout的style*/
main,footer {
font-family: Arial, sans-serif;
text-align: center;
}
p {
font-size: 15px;
margin-top: 20px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1>List of Files</h1>
<table>
<tr>
<th>File Name</th>
<th>File Name</th>
<th>File Name</th>
<th>File Name</th>
<th>File Name</th>
<th>File Name</th>
</tr>
<?php
// Directory path
$dir = "./";
// Get all files and directories sorted by modification time
// $files = scandir($dir, SCANDIR_SORT_TIME | SCANDIR_SORT_ASCENDING); //按照修改时间升序 SCANDIR_SORT_DESCENDING
$files = scandir($dir, SCANDIR_SORT_ASCENDING); //按照首字母升序
$count = 0;
foreach ($files as $file) {
if ($file != "." && $file != ".." && (substr($file, -5) == ".html" || substr($file, -4) == ".php")) {
if ($count % 6 == 0) {
echo "<tr>";
}
echo "<td><a target='_blank' rel='noopener' href='" . $root_url . $file . "'>" . $file . "</a></td>";
$count++;
if ($count % 6 == 0) {
echo "</tr>";
}
}
}
if ($count % 6 != 0) {
while ($count % 6 != 0) {
echo "<td></td>";
$count++;
}
echo "</tr>";
}
?>
</table>
<!--下面的main,footer是有关logout的style-->
<main>
<p>You have successfully logged in.</p>
<p><a href="<?php echo $scriptname; ?>?logout=true">Logout</a></p>
</main>
<footer>
<p>Copyright © 2023 <?php echo $company_name; ?></p>
</footer>
</body>
</html>