-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails.php
85 lines (77 loc) · 1.91 KB
/
details.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<link rel="stylesheet" href= "./css/detail.css">
<?php
if(!isset($_SESSION)){
session_start();
}
include("./database/config.php");
include("./database/opendb.php");
if(!isset($_SESSION)){
session_start();
}
if(!isset($_SESSION["id"])) {
echo "error";
exit();
}
if(isset($_GET["file"])){
$id=$_GET['file'];
}else{
echo "error";
}
$pattren = "/[^0-9]/";
$id= preg_replace($pattren,"",substr(trim($id),0,40));
if($id==""){
echo "error 205";
exit;
}
if($id!==$_GET["file"]){
echo "error 205";
exit;
}
$query="SELECT * FROM files WHERE id = ? AND userid=? ";
$preparedquery=$dbaselink->prepare($query);
$preparedquery->bind_param("ii",$id, $_SESSION["id"]);
$preparedquery->execute();
if($preparedquery->errno){
echo "query error";
}else{
$result=$preparedquery->get_result();
if($result->num_rows===0){
echo " no result found";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./css/index.css">
<title>Document</title>
</head>
<body>
<?php include "./includes/navigation.php"; ?>
<div id="folderbody">
<?php
while($row=$result->fetch_assoc()){
if($row['folder']==true){
echo "This is a folder!";
$preparedquery->close();
include("./database/closedb.php");
exit;
}
echo "<div id=\"filename\">filename: ". $row["filename"]."</div>";
echo "<div id=\"detailbuttons\">";
echo '<a href="deleteconfirm.php?id=' . $row["id"] . '">'." verwijderen</a>";
echo "<a download href='./download.php?fileid=".$id."&filename=".urlencode($row["filename"])."'>Download</a>";
echo "</div>";
};
?>
<a class="detailbutton" href="./index.php">Home</a>
</div>
</body>
</html>
<?php
$preparedquery->close();
include("./database/closedb.php");
?>