• Resolved imartianguy

    (@imartianguy)


    I have a php code that replaces some A tags in the webpage. I need to run this php code only when traffic is coming in from a list of IP addresses. How can I achieve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • $ips = array (
        "127.0.0.1",
        "192.168.0.1"
    );
    
    if (in_array ($_SERVER["REMOTE_ADDR"], $ips)) {
    // Run your code here
    }

    That’s all there is to it. Just set up the IP addresses that you want to check and the code will run for those IP’s.

    Thread Starter imartianguy

    (@imartianguy)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Run php script based on source IP of traffic’ is closed to new replies.