Ban IP Addresses

for osCommerce Online Merchant v2.2

This contribution is dedicated to all those that make returns and false orders. Description: The above code can be modified and new lines can be added to ban a certain list of IP addresses from your website. The exit(); function simply stops the script from that point. Place this at the top of your php scripts to prevent access to those IP addresses listed. Installation ------------ To locate this line in catalog/default.php or catalog/index.php depending on the version: <html <?php echo HTML_PARAMS; ?>> Later to put this code: <?php $banned_ip = array(); $banned_ip[] = '111.111.111.111'; $banned_ip[] = '111.111.111.112'; $banned_ip[] = '111.111.111.113'; $banned_ip[] = '111.111.111.114'; foreach($banned_ip as $banned) { $ip = $_SERVER['REMOTE_ADDR']; if($ip == $banned){ echo "You have been banned!"; exit(); } } // rest of PHP Script here! ?>

Files