2
Hi, I’m having trouble downloading some files. I suspect that someone on the team is 'inputando' a php script that downloads files from the server (such as bd settings in production).
I wonder if it is possible to block the download via script. I have already blocked the direct access by url (http://meuserver/path/file.php) and permissions are for reading only to the apache user. However, when I run the code below, I can download the file and view its contents.
Following is an example of code I wish to inhibit:
$arquivo = "path/file.php";
header("Content-Type: " . $tipo);
header("Content-Length: " . filesize($arquivo));
header("Content-Disposition: attachment; filename=" . basename($arquivo));
I have done several searches and only found how to block direct access, but with the above code it is possible to download the file.
Ps: I currently need to lock a single file.
I already answered a question about it here on the site. It was in Laravel, but the example applies to PHP. You can use authentication or even CAPTCHA to check who’s messing with you.
– Wallace Maxters
Let me get this straight: are you able to download your PHP script? Now I’m in doubt
– Wallace Maxters
I did some tests, but PHP does not come with the open script, it only comes with the texts inside it, IE, the user can not download the code itself.
– caiocafardo
Only html comes, it would be a huge failure if php comes
– Anderson Henrique