How to uniquely identify a remote computer in php?

how to uniquely identify a remote computer in a proxy server environment, I used $ _SERVER ['REMOTE_ADDR'], but all the machines in the proxy network have the same IP address, is there any way

+3
source share
6 answers

Never depend on information from the client. In this case, you are faced with simple network problems (you can never be sure that the client's IP address is correct), in other cases, the client can spoof the information for the purpose.

If you need to uniquely identify your customers, give them a cookie on your first visit, which is what you can do best.

+11
source

Best would be:

 $uid = md5($_SERVER['HTTP_USER_AGENT'] .  $_SERVER['REMOTE_ADDR']);

, , .

+5

, , , ( $_SERVER):

  • HTTP_USER_AGENT
  • HTTP_ACCEPT
  • HTTP_ACCEPT_LANGUAGE
  • HTTP_ACCEPT_ENCODING
  • HTTP_ACCEPT_CHARSET

, , ( , , )...

... : - (

- X-Forwarded-For, :

HTTP- X-Forwarded-For (XFF) - IP- - HTTP- . -RFC- , Squid -.

: , , ( , )

!

+4

, , . , - . , . .

0

-, , , - . ? , ActiveX, , .

, - HTTP , IP- . , , -, , IP- -. ( , client ip.)

, - HTTP HTTP- - , , IP- - , , - , 1- !

0

JKS,

. .

, , .

: cookie, html5 localStorage . . localStorage ( ), , , , , cookie .

, , : timestamp, ip_address, user_agent

, . :

if(isset($_SESSION['failed_logins'])) {
        $failed_logins = $_SESSION['failed_logins'];
        $_SESSION['failed_logins'] = ($failed_logins + 1);
} else {
        $_SESSION['failed_logins'] = 1;
}

setcookie(), localStorage script..

Now I am tracking this person and know how many times they fail to log in.

Then I will write this user data to my fail_login table as described above.

I'm sure this is not the answer you were looking for, but it is really the best way to track users on your site.

0
source

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


All Articles