C
C
Crash2014-04-02 21:45:56
PHP
Crash, 2014-04-02 21:45:56

How to restrict downloading a file from a direct link?

The point is this: the site is a small self-written online store in PHP.
After payment, the user is directed to a page where a special script gives him links to download the files he paid for.
It is necessary to make sure that the direct links issued by the script are not accessible from the outside, outside the script. How can I do that? I hope I explained clearly

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vit, 2014-04-02
@fornit1917

Based on the X-Accel-Redirect header and the internal directive in nginx, you can implement any logic to restrict access. And unlike sending the file directly by a php script, this option is much more efficient, because. The php script will only do the access check, and nginx will already take care of the return.
Usage example: www.opennet.ru/base/net/nginx_x_accel_redirect.txt.html

M
MrButek, 2014-04-02
@MrButek

It is possible to issue a file through a PHP script that, before sending the file, checks whether the user is logged in or not and whether he paid for the file or not.

D
Dmitry, 2014-04-02
@ExileeD

as an option wiki.nginx.org/HttpAccessKeyModule

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question