Contributions

Other (Category Index)
Search: 

Ban IP Addresses

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!
?>

Expand All / Collapse All

Ban IP Addresses v2.0 with Admin JangoF 23 Oct 2008

This is a modification of "Ban IP Addresses" by Manuel Muzas. I based it on the updated code from Bjarne Varoystrand. This contribution allows shop owners to ban customers by IP address from their store through the admin menu. A message is displayed to banned users who try to access the store.

Features:
- IPs are stored in the database instead of in a file
- Admin page where you can view/add/change/remove IP addresses
- Works without "User Tracking" contribution, is not dependant on other contributions
- Works great in conjunction with the "Order IP Recorder" contribution (http://www.oscommerce.com/community/contributions,2138/)

Banned IP with admin Mircea Teleleu 18 Aug 2004
Note Ben 18 Aug 2004
Banned IP with admin Mircea Teleleu 18 Aug 2004
Banned IP with admin Mircea Teleleu 18 Aug 2004
Ban IP Addresses Bjarne Varoystrand 17 Aug 2004
Ban IP Emmett 5 Aug 2004
Ban IP Anonymous 24 Apr 2004
banned_ip.zip James L. Kirkland 7 Feb 2004
Ban IP Addresses Manuel Muzas 28 Sep 2003

Note: Contributions are used at own risk.