-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdown1.php
58 lines (44 loc) · 1.36 KB
/
down1.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
<?php
//Get file
require('dbconnect.php');
$id = $_GET['id'];
$result=mysqli_query($conn,"SELECT * FROM filestore where file_id = '$id'");
if($result->num_rows >0)
{
while($row=$result->fetch_assoc())
{
$id = $row['file_id'];
$mobile = $row['sender'];
//$subject=$row[teacher_subjects];
$filename= $row['filename'];
}
//echo $filename;
$abc = shell_exec("java DecryptFile ".$filename );
//echo $abc;
$url = "c:/xampp/htdocs/BlowTransfer/uploads/decrypt/".$filename;
$source = file_get_contents($url);
//Image Mime types
$images = array('jpg'=>'image/jpg','png'=>'image/png','png'=>'image/png');
//Is it an image extention
if(in_array(substr($url,-3),$images)){
$type = $images[substr($url,-3)];
}else{
//No its somthing else
$type = 'application/octet-stream';
}
// Set the headers
header('Content-Description: File Transfer');
header('Content-Type: '.$type);
header('Content-Disposition: attachment; filename='.basename($url));
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . sprintf("%u", strlen($source)));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: public');
//echo the source
echo $source;
}
else
echo "failed";
// //C:/Users/ypila/Desktop/blow/decrypt/
?>