-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin_files.php
47 lines (46 loc) · 1.27 KB
/
admin_files.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 $title = "Admin Files";
session_start();
?>
<html>
<?php
include("head.php");
?>
<div class="container">
<?php
if (isset($_SESSION["userisadmin"])) {
if ($_SESSION["userisadmin"] == 1) {
include("admin_menu.php");
?>
<pageheader>Files</pageheader>
<table class="files-table">
<tr>
<th>Username</th>
<th>File Name</th>
<th>Download</th>
<th>Delete</th>
</tr>
<?php
$files = $db->query("select * from files inner join users on files.user_id = users.id");
foreach($files as $item){
if($item["is_folder"] == 1)
continue;
?>
<tr>
<td><?php echo $item['username']; ?></td>
<td><?php echo explode("_", $item['file_name'])[2]; ?></td>
<td><a href="<?php echo 'uploads/'.$item['file_name']; ?>" download>Download</a></td>
<td><a href="admin_delete_file.php?filename=<?php echo $item['file_name']; ?>">Delete</a></td>
</tr>
<?php
}
?>
</table>
<?php
}
}
else {
echo "please <a href='login.php'>login</a>";
}
?>
</div>
</html>