-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
34 lines (32 loc) · 1009 Bytes
/
index.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
<?php
session_start();
include 'db.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
$user_id = $_SESSION['user_id'];
$query = $pdo->prepare("SELECT * FROM files WHERE user_id = :user_id");
$query->execute(['user_id' => $user_id]);
$files = $query->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<title>File Management</title>
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<h1>Welcome to File Management</h1>
<a href="upload.php">Upload File</a> | <a href="logout.php">Logout</a>
<h2>Your Files</h2>
<ul>
<?php foreach ($files as $file): ?>
<li><?php echo htmlspecialchars($file['filename']); ?> - <a href="files/<?php echo htmlspecialchars($file['filename']); ?>">Download</a></li>
<?php endforeach; ?>
</ul>
<?php if ($_SESSION['is_admin']): ?>
<a href="admin.php">Admin Panel</a>
<?php endif; ?>
</body>
</html>