-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxdwn.php
31 lines (29 loc) · 959 Bytes
/
xdwn.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
<?php
/*
xdwn.php - autore sconosciuto, già usato con applicazione di Peco Rara Gente
usa la variabile di sessione $_SESSION["xcsv"]
Download del file $file, il codice php iniziale serve per
costringere il browser a non usare nessuna cache e a scaricare
direttamente il file.
*/
session_start();
if ($_SESSION["user_id_pattern"] == "bravo ragazzo")
{ //sessione
$file = $_SESSION["xcsv"];
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
unlink($file);
exit;
}
} //sessione
?>