JavaScript-How the client verifies that multiple messages published are not from the same IP

Source: Internet
Author: User
Tags get ip
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.