Answer the question
In order to leave comments, you need to log in
How to make a link work only for one ip address?
There is a file sharing service, it has links to download files. How to make the link work only for one ip address?
Answer the question
In order to leave comments, you need to log in
if($_SERVER[REMOTE_ADDR] === '....') echo "<a href='/'>Hidden</a>";
Write down the IP when you first download, generating a link.
In this case, the file must be given not in the form of a direct path, but through a proxy script that will also check the ip and give the file.
Perhaps there is a point in unique links that live for some limited time.
I don’t know how everything is arranged there, but on the download page, paste this code, changing it to your parameters
@if($_SERVER[REMOTE_ADDR] === '192.168.1.1')
<a href='{{route('page.download')}}'>Download</a>;
@endif
It is better to do this not in PHP, but in Nginx: nginx.org/ru/docs/http/ngx_http_secure_link_module.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question