Protect your PHP file; as?

I have a site for ads, and our partner (who runs another site for ads) must have access to the file on our server.

The file is called 'partner.php'.

This file simply prints out some information about the ads on our site.

Therefore, for our partners, they just need to access "www.domain.com/partner.php?id=1234" in order to access this information.

I plan to add a hash to the URL so that outsiders do not have access to the file. But I do not know how to do this ...

Is there anyone who could point me in the right direction?

I was told by phone that I can use a 32-line MD5 string and add it to the URL, but I really don't know how to start, or what do they mean by that?

Does anyone know what they mean?

Examples are accepted.

thank

+3
source share
4 answers

I plan to add a hash to the URL so that outsiders do not have access to the file. But I do not know how to do this ...

don't do it like that. The hash is great for one-time links, such as email confirmation, but not for sensitive information. The hash will be present in user history, cache and proxy protocols; it can be divided randomly.

You need to learn the correct login based authentication.

Some starting points:

+2

Hash, IP-. / , - IP- .

$ip = $_SERVER['REMOTE_ADDR'];
+1

?

, .htaccess IP-.

. htaccess. " IP-"

+1

HTTP-, , . htaccess

Adding a hash to the URL means that you pass the GET parameter to the script and check it when the script runs. If the value is not expected, the script may just die (); or throw some kind of mistake.

But I would really NOT recommend a hash thing, this is a bad idea.

0
source

Source: https://habr.com/ru/post/1771492/


All Articles