TNG Rip Prevention

From Genwiki

Revision as of 08:47, 19 November 2006 by Admin (Talk | contribs)

Jump to: navigation, search

If you are not comfortable with html and php editing, this page may not be for you


Overview

This TNG modification will help deter some of the automated processes that simply rip (copy) our sites for potential comercial gain. It monitors the time interval between visitor accesses. If the accesses are rapid and repeated, a warning is issued. If the accesses continue rapid and repeatedly, the visitor is temporarily banned and an explanation page is displayed. Warnings and bans are disabled for administrators.

In addition to the warning and ban pages, a simple access stats page is available on the admin page. The left banner will include an entry (in English) "Show Access" which will display the current stored access information. I have sorted it by Bans, Warnings, Total fast page access, and Total accesses. A button is included to optionally sort the information using alternate columns. A view only version of the access stats may be viewed on my site as well. The delete functions are disabled since you are not logged in. Check it here ( I'm always playing with the colors and fonts, so that would be up to your choosing.)

To view an example of this, you may access my site and simply hit the refresh quickly. A few rapid accesses will result in a warning page. Simply wait a few seconds and operation will return to normal. Repeated rapid access will result in a 60 second ban where an explanation page is displayed.


Rev 1.5 Oct 22, 2006 - Updates for v6.0.1, added more controls for deletions, google and inktomi are now summarized
Rev 1.4 Oct 1, 2006 - Minor feature added, if the user is administrator, warnings and bans are disabled
Rev 1.3 Sep 29, 2006 - Updated the showaccess.php display page, buttons look a little more organized, no functional changes


Requirements

  1. A working TNG installation - see The Next Generation of Genealogy Sitebuilding
  2. A backup of your TNG files
    • begin.php
    • admin/leftbanner.php


Side Effects

  1. As with any modification to a TNG file, this modification will get lost during your next TNG version update and you will need to re-implement the mod. However, it is only a single line addition to each of the files.


TNG Modifications

The following zip file contains the necessary files to allow the addition of this feature.

  • The zip file TNG Rip Prevention Rev 1.5.zip contains:
    • the two display pages: rip_warning.html and rip_ban.html
    • begin.php - a modified TNG file
    • check_access.php - the visitor monitor code
    • version 5.1.4/admin/showaccess.php - the visitor access display code
    • version 5.1.4/admin/leftbanner.php - a modified TNG file
    • version 6.0.0/admin/showaccess.php - the visitor access display code
    • version 6.0.0/admin/leftbanner.php - a modified TNG file
      • version 6.0.1 - use the V6.0.0 file set
    • version 6.0.2/admin/showaccess.php - the visitor access display code
    • version 6.0.2/admin/leftbanner.php - a modified TNG file
      • version 6.0.3 - use the V6.0.2 file set, no changes required


  • IF you are running Version 5.1.4 or 6.0.0 to 6.0.3 then

If you have previously modified your TNG begin.php or admin/leftbanner.php file, do not continue. You WILL lose any changes to that file you have previously made.

  1. backup your existing TNG begin.php and admin/leftbanner.php file
  2. download this zip {TNG Rip Prevention Rev 1.5.zip}
  3. unzip it, examine the contents
  4. open the rip_warning.html file and edit the contents (you can use something like notepad or wordpad)
    • personalize the text with your name, or modify to suit
  5. open the rip_ban.html file and edit the contents (you can use something like notepad or wordpad)
    • personalize the text with your name, or modify to suit
  6. copy your version of rip_ban.html and rip_warning.html to the base TNG folder (where the begin.php file is)
  7. copy check_access.php and the begin.php file to the same base TNG folder
  8. copy the appropriate admin/showaccess.php and admin/leftbanner.php to the admin folder in the base TNG folder
    • select these two files from the applicable version directory
  9. check it out


  • IF you are NOT running v5.1.4/v6.0.x or you HAVE made changes to either of the above files then, you must add the single include line to the begin.php file on your own and the link to the showaccess.php file in the leftbanner.php file. Follow the instructions above, except open and edit the begin.php and admin/leftbanner.php files, do not copy them.
  1. before following the instructions above
    • open and edit your begin.php from:
 include("config.php");
  • to
 include("config.php");
 include($cms[tngpath] . "check_access.php");
  • open your admin/leftbanner.php and edit the following:
 <tr><td><a href="reports.php" target="main" class="lightlink"><?php echo $admtext[reports]; ?></a></td></tr>
 <tr><td><a href="languages.php" target="main" class="lightlink"><?php echo $admtext[languages]; ?></a></td></tr>


  • to
 <tr><td><a href="reports.php" target="main" class="lightlink"><?php echo $admtext[reports]; ?></a></td></tr>
 <tr><td><a href="showaccess.php" target="main" class="lightlink">Show Access</a></td></tr>
 <tr><td><a href="languages.php" target="main" class="lightlink"><?php echo $admtext[languages]; ?></a></td></tr>



Customizations

Although the default values in the check_access.php file work well for me, the parameters may be customized

  • visitor access speed detection
  • number of fast accesses before a warning is displayed
  • number of fast accesses before a ban is displayed
  • length of time for a visitor ban
  • names of valid search engine indexers



How do I remove old entries, or the very low count accesses

Table maintenance is provided while viewing the access table in the "Show Access" under the admin area. Selecting either of the Date or Page Hit "Sort" buttons will display the "Del" option button to enable record deletions. Clicking the "Del" button will display the access page with an individual button in each of the date or hit cells. These cell buttons will immediately remove all table entries before the date selected, or all table entries with fewer page hits, depending on the "Del" operations that has been activated.


In the event of a problem with your TNG site

  1. copy your backup begin.php to your base TNG folder
  2. copy your backup leftbanner.php file back to the admin sub folder
    • all should be well now
  3. you may also delete the additional files you copied in


Support

  1. You're sort of on your own... If you have a specific question, or feel some additional info in the above would help others, feel free to contact me directly. Mail me here
    • Please post suggestions, or your own flavour of this mod to the forum or list
Personal tools