-
Notifications
You must be signed in to change notification settings - Fork 0
/
filesList.php
68 lines (67 loc) · 1.7 KB
/
filesList.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<head>
<meta charset="utf-8"/>
<title>Files List</title>
<style type="text/css">
body{
width: 760px; /* how wide to make your web page */
background-color: teal; /* what color to make the background */
margin: 0 auto;
padding: 0;
font:12px/16px Verdana, sans-serif; /* default font */
}
div#main{
background-color: #FFF;
margin: 0;
padding: 10px;
}
</style>
</head>
<body><div id="main">
<?php
session_start();
$username = $_SESSION['username'];
$filesArray = scandir($username);
printf("<h1>Welcome to the File Sharing System, %s!</h1>",
htmlentities($username)
);
?>
<form action="logout.php" method="GET">
<p>
<input type="submit" value="Logout" />
</p>
</form><br>
<h2>Upload a file:</h2>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
<label for="uploadfile_input">Choose a file to upload:</label> <input name="uploadedfile" type="file" id="uploadfile_input" />
</p>
<p>
<input type="submit" value="Upload File" />
</p>
</form><br>
<h2>View a file:</h2>
<form action="viewer.php" method="GET">
<p>
<label>Enter the file name to view: <input type="text" name="filename" /></label> <input type="submit" value="View" />
</p>
</form><br>
<h2>Delete a file:</h2>
<form action="deleter.php" method="GET">
<p>
<label>Enter the file name to delete: <input type="text" name="filename" /></label> <input type="submit" value="Delete" />
</p>
</form><br>
<h2>Your files list:</h2>
<ul>
<?php
for($i=2; $i<count($filesArray); $i++){
printf("<li>%s</li>",
htmlentities($filesArray[$i])
);
}
?>
</ul>
</div></body>
</html>