IP Blocker for Zen Cart v1.5.0 through v1.5.5
Version 2.1.3 by lat9
Current Support Thread at Zen Cart Forums: http://www.zen-cart.com/showthread.php?211251-IP-Blocker-1-5-1
Version History:
- v1.0.0, 2009-09-10, Initial release by $d (noblesenior@gmail.com).
- v2.0.0, 2014-01-09 (lat9)
- Converted this readme to HTML format.
- Add the admin-page registration to allow the tool to work in the Zen Cart v1.5.0+ admin environment.
- Converted (deprecated) ereg calls to preg_match calls.
- Moved all language strings to defined values.
- Converted HTML input and form tags to use the Zen Cart built-in functions.
- Renamed IP Blocker's login page script to special_login.
- v2.0.1, 2014-01-30:
- BUGFIX: Non-superusers cannot access the tool. Thanks to Design75 for quickly pointing out the solution! Changed:
- /YOUR_ADMIN/includes/extra_datafiles/ip_blocker_filenames.php
- /YOUR_ADMIN/includes/languages/english/ip_blocker.php
- Add a lockout count to the configuration. Changed:
- /special_login.php
- /YOUR_ADMIN/ip_blocker.php
- /YOUR_ADMIN/includes/functions/extra_functions/ip_blocker_functions.php
- /YOUR_ADMIN/includes/languages/english/ip_blocker.php
- v2.0.2, 2014-02-14:
- BUGFIX: Debug code left on special_login page.
- BUGFIX: Handling change required for session-based variables. Thanks to mc12345678 for making me look!
- Changed:
- /special_login.php
- /includes/init_includes/init_ip_blocker.php
- v2.1.0, 2014-03-02:
- Simplify the admin interface to a single page; installation is now performed via an init script.
- Enable a single-click from the admin's whos_online page to add the selected IP address to the blocked list.
- v2.1.1, 2014-07-09:
- BUGFIX: PHP warnings generated.
- BUGFIX: Readme incorrectly indicates "192.168.* translates to the range 192.168.0.0-192.168.255.255"; remove this text.
- Changed:
- /YOUR_ADMIN/ip_blocker.php
- v2.1.2, 2014-12-20:
- CHANGE: Use Zen Cart v1.5.4 version for core-file change basis. Changed:
- /YOUR_ADMIN/whos_online.php
- v2.1.3, 2015-12-30:
- CHANGE: Use Zen Cart v1.5.5 version for core-file change basis. Changed:
- /YOUR_ADMIN/whos_online.php
What it does
IP Blocker allows you to block accesses to your store, based on the IP address of the access. Once you've copied the plugin's files to your store, use your Zen Cart admin's Tools->IP Blocker to specify the list of addresses. There are two blocks of IP addresses that you specify:
- Blocked IP Addresses. An IP address that falls in one of the ranges specified here is redirected to your store's
/special_login.php script. If the IP Blocker password is correctly entered on that login screen, that IP address is allowed access for that session's duration.
- Allowed IP Addresses. Use this IP address list to provide a list of exceptions to the blocked list above. If an IP address falls into one of the ranges specified here, access is allowed to your store even though the address also falls into a blocked address range.
The tool allows you to specify:
- Enable IP Blocker? — Identify whether (Yes) or not (No) you want the IP Blocker to block certain IP addresses from accessing your Zen Cart store.
- Login lockout count — Identify the number of invalid passwords that the IP Blocker will accept from a given IP address before it simply whitescreens. A value of 0 (the default) allows an infinite number of invalid passwords.
- Password — Enter the password (the default value is 123456) that will be accepted by the
special_login.php script, allowing an otherwise blocked IP address to access your store.
- Blocked IP Addresses and Allowed IP Addresses — For each of the IP Address lists, you enter one address specification per line using one of the following formats:
- Single-address Format. Enter the full IPv4-formatted address, e.g. 192.168.1.17.
- Full-Octet Range Format. Enter the upper octets for the IP address, then use the asterisk (*) to indicate that all lower octets are to be included. For example, 192.168.1.* translates to the IP address range 192.168.1.0-192.168.1.255.
- Sub-Octet Range Format. Enter the upper octets for the IP address, then use the format n/m to specify the lowest octet range from n to m. For example, 192.168.1.1/17 translates to the IP address range 192.168.1.1-192.168.1.17.
The tool will consolidate your IP address specifications, e.g. 192.168.1.0/255 will be stored as 192.168.1.*.
A modification is also provided to your admin's Tools->Who's Online, presenting a link entitled Block this IP next to each IP address if the IP Blocker is enabled. Clicking that link will result in the associated IP address being added to the Blocked IP Addresses list.
Note: Starting with v2.1.0, the tool stores only the IP address format used by the store-side processing to conserve database space. The displayed version of the blocked and allowed address lists are computed for the admin-console display.
Installation
There are core-file overwrites in this plugin; you should always backup your cart's database and files prior to making any changes. Once you have unzipped the plugin's distribution file:
- Rename the /YOUR_ADMIN directory to match your Zen Cart admin directory's name.
- Copy the plugin's files to your Zen Cart's file system:
- /special_login.php
- /includes/auto_loaders/config.ip_blocker.php
- /includes/extra_datafiles/ip_blocker_database_tables.php
- /includes/init_includes/init_ip_blocker.php
- /YOUR_ADMIN/ip_blocker.php
- /YOUR_ADMIN/whos_online.php
- /YOUR_ADMIN/includes/auto_loaders/config.ip_blocker_admin.php
- /YOUR_ADMIN/includes/extra_datafiles/ip_blocker_database_tables.php
- /YOUR_ADMIN/includes/extra_datafiles/ip_blocker_filenames.php
- /YOUR_ADMIN/includes/functions/extra_functions/ip_blocker_functions.php
- /YOUR_ADMIN/includes/init_includes/init_ip_blocker.php
- /YOUR_ADMIN/includes/languages/english/ip_blocker.php
- /YOUR_ADMIN/includes/languates/english/extra_definitions/ip_blocker.php
Removing the IP Blocker
To remove the IP Blocker tool from your Zen Cart:
- Delete the files that you copied during the plugin's installation.
- Run the /ip_blocker_uninstall.sql using your Zen Cart's Tools->Install SQL Patches.