Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Ban A Specific IP From Accessing Your Site With PHP
#1
I was just messing around with a little PHP, and I thought of this way to block access to certain IP addresses from accessing your web page. I originally made it to make it so people who aren't me cannot view a certain page, but just changed it from if not to if and there you have it.

PHP Code:
<html>
<
head>
<
title>Banned IP</title>
</
head>

<?
php
If ($_SERVER['REMOTE_ADDR'] == "1.1.1.1"){ // Replace 1.1.1.1 with the IP you want to block access
echo 'Your IP is banned from accessing this webpage.<br /><br />';
}
?>
</html> 
Reply


Messages In This Thread
How To Ban A Specific IP From Accessing Your Site With PHP - by BreShiE - 01-11-2012, 03:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to track bandwidth for specific files and pages? dipped9900 1 861 07-14-2012, 05:25 PM
Last Post: 'Snorlax
  [PHP] - PHP White Paper --([-S7N-])-- 1 1,062 04-13-2010, 09:42 PM
Last Post: SLiM

Forum Jump:


Users browsing this thread: 4 Guest(s)