// IP to ban $banned_ip = "1.2.3.4"; // user's IP is held in the $_SERVER variable $user_ip = $_SERVER['REMOTE_ADDR']; // check if user's IP matches banned IP if($user_ip == $banned_ip) { echo "Access denied"; } // multiple IP addresses? $banned_ips = array("1.2.3.4", "4.3.2.1"); // check for match foreach($banned_ips as $ip_ban) { if($user_ip == $ip_ban) { echo "Access denied"; } } ?>
Monday, July 26, 2010
Simple PHP Ban IP Address Script
Labels:
Web Design Company Chennai
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment