MyBB Community Forums

Full Version: Adsense Blocking Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to install a script on my site that removes adsense when it is viewed X number of times....or if it is clicked more than X times. The script is called Adsense Click Lock. The instructions are pretty basic but I can not seem to get it to work with MYBB. I am trying to get this code to be included on everypage that adsense shows. Index,ForumDisplay,ShowThread,PostBit.

The Code Is <? include "adsenselock.php"; ?>

The instructions are as follows:
Instructions For Use

Before using this software, you need to create an SQL database on your web host.

If you don't know how to do this, you should be able to ask your web hosting company to create one for you. They should send you the database name, user name and password values for the database, which you should enter into the software (see below).

If you would prefer to create the database yourself, you can view detailed step-by-step instructions on how to create an SQL database. You will need to be connected to the Internet to view the instructions. They are in the form of a PDF file, so you will need Adobe Acrobat installed on your PC in order to read them (click here to download Adobe Acrobat if you don't already have it installed). To read the instructions, click here.


Once you have created your SQL database, click the button above then enter your details into the boxes as follows:

Maximum Adsense clicks
You can select any number from 1 upwards. For each visitor to your site, this is the maximum number of Adsense ads that he or she can click on. Once a visitor has clicked on this number of ads, your Adsense ads are automatically hidden from that visitor. Note that although this solution works with the latest versions of Internet Explorer and Firefox browsers, it is not guaranteed to work with all browsers, so you should also use the secondary protection mechanism too.

Maximum Page Views
This feature provides a secondary protection mechanism and it is strongly recommended that you use it. You can select any number from 1 upwards, but a typical value is 3 to 5. For each visitor to your site, this is the maximum number of page views on which Adsense ads will be shown. If a visitor views more than this number of pages, your Adsense ads are automatically hidden from that visitor. If you do not want to use this feature, simply set the number to a very large value (such as 1000).

Hide Adsense Ads For
You can have the ads hidden for an hour, 3 hours, 12 hours, a day, 3 days, 7 days, 15 days, 30 days or forever. The default is 3 days, which is generally more than adequate. This means that if a visitor returns to the site any time within 3 days of the ads being hidden, the ads will still be hidden. If they return to the site after 3 days, the ad click and page view counters will be reset - and Adsense ads will be visible again.

Note that the SQL database keeps a record for each visitor. These records are re-used when they expire (i.e. when the Hide Adsense ads for period has elapsed). The records are small - only 12 bytes each - but the longer the Hide Adsense Ads For period, the larger your database will be. It is not recommended that you use the Forever setting as the records will never get reused and the database will get bigger and bigger over time.

Hide Any Google Search Forms
If this checkbox is checked, any Google Adsense Search forms on your web pages will be hidden as well as your Adsense ad blocks. This gives extra protection, since the search results also contain your Adsense code. (If your pages do not contain Google Adsense Search forms, this checkbox has no effect). Please also see the Protection Issues section below for more details on search form protection issues.

SQL Database Name
SQL User Name
SQL Password
SQL Host
SQL Table Name
These are the details of your SQL database. The host entry is usually left as "localhost" and the table name is usually left as "adsensect".

Script Path
This box is usually left blank. See the Single Script Installation section below for details of the use of this box.

Replacement Ads
The software allows you to replace up to 8 Adsense ad blocks. To enter a replacement ad, select the number using the drop-down box, then type or paste the replacement ad into the large text box. To paste, right click inside the large text box and select "Paste" from the menu.

The ads are replaced in the order in which they are encountered in the HTML of the web page. If you have enabled Hide any Google search forms, any search forms are replaced after all the ad blocks. For example, if you had two ad blocks and a search form, ads 1 and 2 would replace the Adsense ad blocks and ad 3 would replace the search form.

If you leave any of the replacement ads blank, the Adsense ads will be hidden with no replacement ad inserted in their place.

Load Default Ads
This button loads the Replacement Ads with a standard set of three Amazon ad blocks. It provides a quick and easy way to set up replacement ads, but is only really useful if your web pages have a large Adsense ad block at the top (300x250 or 250x250 pixels), a banner in the middle (468x60 pixels) and small ads at the side (180x150 pixels or similar). This is a common layout, but there are of course many different page layouts in use on the Internet. The replacement Amazon ad blocks are 300x250, 468x60 and 180x150 pixels respectively. When you click the Load Default Ads button, a small dialog will appear, allowing you to enter your Amazon affiliate ID and select the colors for the ads so that they match your web pages. Note that the Load Default Ads button is purely provided for convenience. You can instead enter your own Amazon ads - or any other replacements ads you want into the software.

Create Script Button
When you have filled in the boxes, click the Create Script button then select where to save the new script file on your PC. The script file is usually named "adsenselock.php" but you can choose a different name if you wish. The software will also create a file called ".htaccess" in the same folder on your PC.

You should upload both these files to your web host. They should be uploaded into the same folder as any web pages that are to be protected. If you have more than one folder containing such web pages, upload the two files to each of the folders. If you would prefer to have a single installation of the script to protect all your folders, see the Single Script Installation section below.

You may use the scripts created by this software on as many websites as you own personally, but you must not distribute, give away or sell the script or any part of it for use by anyone else.



Create Your Database Table
Once you have uploaded the script to your web host, you need to create your database table. You only need to do this once, even if you are protecting files in multiple folders. To do this, activate your web browser and enter the following, replacing mysite.com with the web address where you uploaded the script. If you uploaded the script to more than one folder, you can enter any of the web addresses.

http://***.mysite.com/adsenselock.php?createdb



Using The Software On Web Hosts Without The Mod Rewrite Feature
If your web host supports "Mod Rewrite" and uses ".htaccess" files, you do not need to modify any of your web pages in order for this software to work. If you are not sure, simply try the software on your website to see if it works. Alternatively you can ask your web hosting company whether it supports "Mod Rewrite".

If your web host does not support Mod Rewrite, you will need to make a small change to every web page. First of all, every web page will need to be a ".php" file. If you are using HTML files, you will need to rename them to ".php" files. For example, "page1.html" would become "page1.php". Any links to the pages will also need to be changed.

You will also need to add the following line to the top of every web page...

<? include "adsenselock.php"; ?>



Single Script Installation
This section only applies if your web host does support "Mod Rewrite".

The usual solution is to upload the script created by this software and the associated htaccess file into every single folder on your web host which contains web pages to be protected. It is however possible to upload a single copy of the script (and a single htaccess file) onto a website so that all subfolders (and subdomains) of the website are protected.

In order to do this, you need to enter the full script path into the Script Path box on the software. The easiest way to find your full script path is to use the software to create the script as normal (with the Script Path box blank) then upload the script to your web host. Now activate your web browser and enter the following, replacing mysite.com with the web address where you uploaded the script to:

http://***.mysite.com/adsenselock.php?getpath

The script path should be shown in your browser. Copy the path to your Windows clipboard. Now activate the Create Adsense Lock Script software again, paste the script path into the Script Path box on the software and then click the Create Script button again. The software will now generate a new script and new .htaccess file. Upload these two files to your web host. Create your database table (as described above) and the software should then protect all files and subfolders on your website.
so, where is the link to software I didn't see it in this threat.
I did not put a link for the software. It is not free and the only info available is what I have posted. It works well on html sites that are renamed to php pages. However I believe the problem is my host uses suphp and I need to point php.ini in the htaccs file. However that is also proving to be an issue for some reason.