ring-trial



filter by IP using PHP

I bump into a problem when I need to filter my application to be accessed from certain IP only. So, some googling around, i found s simple code to do this.

$targetAddr = "192.168.1..*";

if (ereg($targetAddr, $_SERVER['REMOTE_ADDR'])) {
        echo "";
} else {
        die("Sorry. Not allowed from your IP.");
}

This simple script will allow only IP that comes from 192.168.1.*, and will block all other IPs. You might want to put this in a file, and include it in all other code files.

Happy coding! :)

No related posts.


0 Responses to “filter by IP using PHP”

  1. No Comments

Leave a Reply





Get Chitika | Premium
Eye Shadow iPhone 4 Case speckcase
Eye Shadow iPhone 4 Case by MiPhoneCase
See more iphone 4 cases
Make Your Own iPhone 4 Case speckcase
Make Your Own iPhone 4 Case by mvdesigns
More iPod touch cases

Subscribe

Subscribe to my RSS Feeds