OpenCart 2.1.0.2完全禁用联盟模块求助:每日遭20-25个机器人账户注册
Hey there! I’ve dealt with this exact bot-spam issue on OpenCart 2.1.0.2 before, so let’s walk through all the steps to completely shut down the affiliate module and stop those unwanted bot accounts from being created.
Step 1: Disable the Affiliate Module & Registrations via Admin
Start with the core admin settings to turn off the module at its root:
- Log into your OpenCart admin dashboard
- Navigate to Extensions > Modules
- Locate the "Affiliate" module and click the Disable button (it’ll gray out once turned off)
- Next, go to System > Settings > Edit your store > Option tab
- Scroll to the "Affiliate" section and set Allow Affiliate Registrations to No
Step 2: Remove Affiliate Links from Your Frontend
Bots often target visible affiliate entry points, so clean up your theme files:
- Access your store’s files via FTP or cPanel File Manager
- Go to
catalog/view/theme/[your-theme-name]/common/ - Open
header.tplandfooter.tpl(plus any other template files that might have affiliate links) - Find lines like
<a href="<?php echo $affiliate; ?>">Affiliate</a>and either delete them or comment them out with<!-- ... -->
Step 3: Block Direct Access to Affiliate Pages
Even without frontend links, bots might try to hit affiliate URLs directly. Add safeguards to controller files:
- Navigate to
catalog/controller/affiliate/ - Open
account.php,register.php,login.php, and other affiliate-related controller files - At the top of the main
index()method (or primary method) of each file, add this code snippet:// Redirect if affiliate module is disabled if (!$this->config->get('module_affiliate_status')) { $this->response->redirect($this->url->link('common/home')); }
This will send anyone trying to access these pages straight to your homepage.
Step 4: Clean Up Existing Bot Accounts
Don’t leave the spam accounts cluttering your system:
- In your admin panel, go to Marketing > Affiliates
- Use checkboxes to select all suspicious bot accounts (look for generic emails/usernames) and click Delete
- For bulk cleanup, run this SQL query (back up your database first!):
DELETE FROM oc_affiliate WHERE email LIKE '%bot%' OR username LIKE '%bot%'; -- Replace `oc_` with your actual database table prefix if it’s different
Once you’ve completed all these steps, the affiliate module will be fully disabled, and bots won’t be able to create new accounts anymore.
内容的提问来源于stack exchange,提问作者Rajesh Kumar

