Good day to all.
There is such a task: you need to give each user a unique php script that is generated automatically. Is it possible to somehow organize this or need to ask the user to change the extension after receiving the file?
Tried to do by sending headers. Here is the code:
$row = mysql_fetch_array($sql); $filename = $row['filename'] . '.php'; $source_file = 'wp-block.txt'; $size = filesize($source_file); $f=fopen($source_file, 'r'); header("HTTP/1.1 200 OK"); header("Connection: close"); header("Content-Type: application/octet-stream"); header("Accept-Ranges: bytes"); header("Content-Disposition: Attachment; filename=". $filename); header("Content-Length: ". $size); echo fread($f, $size);
but in the end, when downloading the extension is replaced by htm. Is it possible to do this and how?
"text/plain"
- used this. - Aferist