When you can publish more than one message anonymously, how to determine whether the published information is from the same IP address, please say the idea of implementation, JavaScript or PHP line? Is it possible to validate a message without uploading the IP address as part of the data to the database?
Reply content:
When you can publish more than one message anonymously, how to determine whether the published information is from the same IP address, please say the idea of implementation, JavaScript or PHP line? Is it possible to validate a message without uploading the IP address as part of the data to the database?
In the HTTP request, the client IP will be taken.
PHP Code:
The first type:
PHP gets the IP algorithm $iipp=$_server["REMOTE_ADDR"];echo $iipp;
The second type:
PHP get IP algorithm $user_ip = ($_server["Http_via"])? $_server["Http_x_forwarded_for"]: $_server["REMOTE_ADDR"; $user _ip = ($user _ip)? $user _ip: $_server["REMOTE_ADDR"]; echo $user _ip;
Read more about this: Http://www.phpweblog.net/jig68/archiv ...
Your question is similar to how anonymous voting prevents the repeated swipe of the ticket.
Can only say, there is no perfect method.
Common methods:
- Registered users. But it doesn't meet your requirements, anonymous.
- IP restrictions. But consider the existence of NAT in many environments (corporate network, school network, mobile network)
- Cookie restrictions. Similar to the method of the @ Jianguo. But it's easy to forge and bypass.
- Verification code. Can only raise the threshold, but can not be eliminated.
As for authentication from the client, a hash of the unique identifier (IP address, or user name, or unique string of cookies) is returned to the client from the server.
Generate one 2038
-to-year permanent cookie
each time the message is sent, this parameter is passed up
Under the groove: Can't this method be realized? Have been stepped on, rely on, anonymous situation, this is more powerful than the check. ip