forked from sandeshghanta/Share-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetcode.php
More file actions
36 lines (36 loc) · 1.49 KB
/
Copy pathgetcode.php
File metadata and controls
36 lines (36 loc) · 1.49 KB
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
<?php
if (isset($_GET['filename']) && isset($_GET['password'])){
$host = "Yours host name";
$username = "Yours database's username";
$password = "Yours database's password";
$link = mysqli_connect($host, $username, $password);
mysqli_select_db($link,"hiddenduetosecurityreasons");
$command = "select * from data where savedname = '".$_GET['filename']."' and password = '".$_GET['password']."';";
$result = mysqli_query($link,$command);
if (mysqli_num_rows($result) === 0){
echo "False";
}
else{
$data = mysqli_fetch_row($result);
$filename = $data[0];
if (isset($_GET['getname'])){
echo $filename;
exit;
}
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header("Content-Disposition: attachment; filename=\"" . $filename . "\";");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($name));
ob_clean();
flush();
readfile("files/".$_GET['filename']); //showing the path to the server where the file is to be download
}
}
else{
echo "False";
}
?>