Contributions
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
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/)
install first this great contribution (User tracking) from here:
http://www.oscommerce.com/community/contributions,1055/
Note |
Ben |
18 Aug 2004 |
|
Not a cont' just a not to you
the package missing...
admin/user tracking
Small errors:
1. move images button_ban_ip.gif and ban_delete_ip.gif from catalog/includes/languages/english/images/buttons to catalog/admin/includes/languages/english/images/buttons
2. replace TEXT_DELETE in catalog/admin/user_tracking_config with TEXT_DELETE_BAN_IP
no package included, just modify
Now you can add and delete ip in admin/user tracking
I Changed the <?php require(DIR_FS_CATALOG . '_banned.php'); ?> so that the
_banned.php instead is placed in the includes directory.
I also changed where _banned.php is included, instead of in index.php (or
default.php, depending on your version). _banned.php is now inlcuded in
application_top.php to restrict access to ALL pages of your catalog.
The third change that was made is cosmetic ;) now _banned.php is "dressed" in
your catalogs colors.
The last change that was made by me is that there are no hardcoded text anylonger,
the banned message is instead in the language file languages/yourlang/_banned.php
(All files is included in the package)
Small addition made to stop banned IPs from entering any part of the your site.
This is a modification of "Ban IP Address" by Manuel Muzas. I updated it to make it easier to manage the IP addresses and lower risk of messing up the index page.
What's Next?
I will add the capability to ban from the admin panel, when I get the time. I only downloaded this because a user decided to test out how many times they could submit bogus orders.
You can also deny access with .htaccess
Description:
This script displays predesignated message to any IP address specified in _banned.php
The 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.
<?php require(DIR_FS_CATALOG . '_banned.php'); ?>
This script is not supported. If it does not work or something goes awry, I take no responsibility.
If you would like to visit my sites, point your favorite web browser to
http://www.volcomm.net/
http://www.kyrkelands.com/
http://www.corporateheaven.com/
Email me if you have questions or a better solution to the problem.
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!
?>
Note: Contributions are used at own risk.