-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.php
More file actions
26 lines (25 loc) · 966 Bytes
/
Copy pathfile.php
File metadata and controls
26 lines (25 loc) · 966 Bytes
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
<?php
//Requires magic quotes to be off
if(isset($_GET['id'])) {
if (preg_match('/^[0-9]+$/', $_GET['id']) == 1) {
$mysqli = new mysqli("localhost", "filebox", "3Y3SUKzQVKHav8fQ", "filebox");
$result = $mysqli->query("SELECT * FROM files WHERE ID = " . $_GET['id']);
if (!$result) {
printf("Errormessage: %s\n", $mysqli->error);
die();
}
if ($row = $result->fetch_assoc()) {
header("Content-length: " . $row['File_Size']);
header("Content-type: " . $row['File_Type']);
header('Content-Disposition: attachment; filename="' . $row['File_Name'] . '"');
echo $row['File_Content'];
}
$result->free();
$mysqli->close();
} else {
echo "Invalid id";
}
} else {
echo "Missing id";
}
?>