forked from SimonT-STHS/STHS-DynamicWebsite-Production
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloadDB.php
More file actions
19 lines (19 loc) · 841 Bytes
/
DownloadDB.php
File metadata and controls
19 lines (19 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
require_once "STHSSetting.php";
$Hash = (string)"";
foreach (getallheaders() as $name => $value) {
if ($name == "Hash"){$Hash = $value;}
}
if(isset($_GET['Key'])){$Hash = filter_var($_GET["Key"], FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW || FILTER_FLAG_STRIP_HIGH || FILTER_FLAG_NO_ENCODE_QUOTES || FILTER_FLAG_STRIP_BACKTICK);}
if (file_exists($DatabaseFile) AND ($CookieTeamNumber == 102 OR $DownloadDBHash == $Hash)){
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($DatabaseFile).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($DatabaseFile));
readfile($DatabaseFile);
exit;
}
?>