Difference between revisions of "TNG Rip Prevention"

From Genwiki

Jump to: navigation, search
Line 22: Line 22:
  
 
{| cellpadding="3"
 
{| cellpadding="3"
 +
|-
 +
| ''Rev 1.11 Apr 26, 2007'' ||  - Correction to automatic datbase table upgrade code.  This corrects the tables for user who have upgrade from rev 1.5 or earlier.
 +
||
 
|-
 
|-
 
| ''Rev 1.10 Apr 26, 2007'' ||  - Cleaned up code to be HTML 4.01 transitional compliant. (admin/showaccess.php si the only file that changed)
 
| ''Rev 1.10 Apr 26, 2007'' ||  - Cleaned up code to be HTML 4.01 transitional compliant. (admin/showaccess.php si the only file that changed)
Line 64: Line 67:
 
The following zip file contains the necessary files to allow the addition of this feature.
 
The following zip file contains the necessary files to allow the addition of this feature.
  
* The zip file [[Media:TNG Rip Prevention Rev 1.10.zip|TNG Rip Prevention Rev 1.10.zip]] contains:
+
* The zip file [[Media:TNG Rip Prevention Rev 1.11.zip|TNG Rip Prevention Rev 1.11.zip]] contains:
 
** the two display pages: rip_warning.html and rip_ban.html
 
** the two display pages: rip_warning.html and rip_ban.html
 
** begin.php - <font color="red">a modified TNG file</font>  
 
** begin.php - <font color="red">a modified TNG file</font>  
Line 86: Line 89:
  
 
# backup your existing TNG begin.php and admin/leftbanner.php file
 
# backup your existing TNG begin.php and admin/leftbanner.php file
# download this zip {[[Media:TNG Rip Prevention Rev 1.10.zip|TNG Rip Prevention Rev 1.10.zip]]}
+
# download this zip {[[Media:TNG Rip Prevention Rev 1.11.zip|TNG Rip Prevention Rev 1.11.zip]]}
 
# unzip it, examine the contents
 
# unzip it, examine the contents
 
# open the rip_warning.html file and edit the contents (you can use something like notepad or wordpad)
 
# open the rip_warning.html file and edit the contents (you can use something like notepad or wordpad)

Revision as of 19:27, 26 April 2007

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


Overview

This TNG modification includes several features:

  • Rip Prevention
It can 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.
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.
  • Site Access Statistics Page
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.)
  • Custom Message to browsing IP address
Create a custom message to specific IP addresses that are browsing your site. This feature allows selection of the IP/Host that is viewing your site, adding a custom message, and monitoring whether they have viewed it or not. The custom message will be displayed for a selectable (1-9) page views, then disappear. The number of page views left will be displayed in the site statistics page. To view this in action, check the link above to the statistics page, sort by time, and your address should be at the top. Since you are not logged in as administrator, the messaging system will only work for your originating IP address/hostname. A default message (max 1000 characters) is included, but may be customized.
  • Specific Host Banning
Provides a convenient way to permanently ban specific user accesses based upon host name. This feature allows selection of specific host names on the "Show Access" page by using the "B"an button. Banned host names will be displayed with their IP address bolded in a red font. Clicking the "B"an button of a banned host name will remove the ban. Users logged in as admin will not be banned, but be careful. Banning your IP, then logging out will cause you to be banned. (You'll have to log in from an alternate IP and then unban yourself).



Rev 1.11 Apr 26, 2007 - Correction to automatic datbase table upgrade code. This corrects the tables for user who have upgrade from rev 1.5 or earlier.
Rev 1.10 Apr 26, 2007 - Cleaned up code to be HTML 4.01 transitional compliant. (admin/showaccess.php si the only file that changed)
Rev 1.9 Apr 23, 2007 - Added feature to allow permanent banning of specific host names.
Rev 1.8 Feb 24, 2007 - Extended the message to 1000 characters, allow selectable # of message views.
Rev 1.7 Feb 19, 2007 - New feature added, Custom messages to IP/hostname of browsers.
Rev 1.6 Jan 15, 2007 - Updates for v6.0.4, updated to include recent security mods per V6.0.4 (begin.php)
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.


Package Contents

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

  • The zip file TNG Rip Prevention Rev 1.11.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.4 or 6.0.3 - use the V6.0.2 file set, no changes required


Installation Instructions

  • IF you are running Version 5.1.4 or 6.0.0 to 6.0.4 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.11.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 use the Messaging Feature

When viewing the site statistics page, locate the particular IP/Hostname of interest. The numbered button in the Host Name column indicates how many views of the message are left. If the number is 0, then clicking on the button will bring up a text edit box with a default message. Edit this, or leave it as is and click ADD. The page will refresh, highlight the Host Name in red, and indicate the number of message views remaining on the button.

If you click a button with a non-zero on it, it will remove the message request.


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