-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabSharedwithme.php
39 lines (38 loc) · 1.19 KB
/
tabSharedwithme.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
<?php
if(!session_id())
session_start();
if(isset($_SESSION['username']) && $_SESSION['username'] !== ""){
include_once("header.php");
$std_id = $_SESSION['user_id'];
$username = $_SESSION['username'];
$user = new User($username);
}else{
header("Location:/UniPortal/");
}
$my_shared_files = "share/munta1/".date("Y");
$my_files = array_diff(scandir($my_shared_files), array('..', '.'));
if(file_exists($my_shared_files)){
$date = new DateTime();
echo "<div class='card p-3'>
<h1 class='text-center'>Files shared with you</h1>
<table class='table table-bordered'>
<thead>
<th>File</th>
<th>Date</th>
<th>File type</th>
<th>Action</th>
</thead>";
foreach($my_files as $file){
$name = explode(".", $file)[0];
$type = strtoupper(explode(".", $file)[1]);
$d = $date->setTimestamp($name);
$shared = $d->format("Y-m-d H:sa");
echo "<tr>
<td>$name</td>
<td>$shared</td>
<td>$type</td>
<td><a href='$my_shared_files/$file' download class='btn btn-sm btn-primary'>Download</a></td>
</tr>";
}
echo "</table></div>";
}