Yii 1.1: blackmodule

This module protects your website content from being copied.

The following arrangements will not guarantee the safety of the content, and are not recommended for old popular sites, but for new sites it can be useful:

  • Disabling shortcut keys Ctrl+C, Ctrl+X, Ctrl+A, Ctrl+U
  • Disabling the context menu on the site
  • Disabling .oncopy and .ondragstart js events
  • When the visitor try to copy a large amount of text (more then 200 characters) or try to view the source code current ip is added to the list of banned and cookies is installed in the browser.
  • If visitors User-Agent found in the list of known spam bots and parsers, the current ip is added to the list of banned.


  1. Add the table 'banned' in your database (import the file sql/banned.sql), do not forget to add a table prefix, if you use it in your application.
  2. Extract the files into your modules folder (for example, /protected/modules/).
  3. Edit your configuration file to register the module:
  1. Add widget to your pages:
<? Yii::app()->getModule('black'); $this->widget('NoCopyWidget'); ?>


Total 4 comments

#18962 report it
TvdS at 2015/02/12 05:17pm
Perfect :)

To not ban users, you have to comment out some code in the NoCopyWidget widget (around line 40). Where the 502 exception is called.

Thank you for the perfect extension! Exactly what I needed ;)

#12272 report it
Daniel at 2013/03/10 07:04pm
No blocking just record

Hi Dismal,

What if I want only to record the users not block them? The one that I really need is to disable context menu and CTRL-X/CTRL-C.

Thank you for your great extension.

Kind regards,


#12077 report it
Dismal at 2013/02/26 10:18am

le_top, thank you for your advice, i'll make this changes

#12061 report it
le_top at 2013/02/25 04:34pm

Hi Interesting module! Some suggestions: - Propose the table creation as a migration (see Migration command line options; - Allow a whitelist; - Blacklist an IP only after a number of trials, and not after the first try (unless it is a known bot).

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: Dismal
  • Category: Security
  • Votes: +6 / -1
  • Downloaded: 532 times
  • Created on: Feb 25, 2013
  • Last updated: Feb 25, 2013