If you run a proxy using the phproxy script you’re very likely to receive one of these :Google AdSense ad serving has been disabled to your site” warnings from Google if you are using Adsense to pay for the running costs of your proxy website. Here we explain why and how to fix the problem.
Like me, you probably only intend to serve up ads on your home page and not your proxified pages for a number of reasons. However, there’s a flaw in the phproxy script that could well end up with you displaying Google Ads on proxified pages. If any of these proxified pages are displaying Adsense ads on pages that break Google’s terms and conditions for displaying advertiser content, then you’ll very likely soon get an email with the subject; “Google AdSense ad serving has been disabled to your site”.
In this post we describe the circumstances in which your ads can appear on pages other than your home page, and we outline a hack to fix the problem.
The problem with the script is that if the proxy is used to view pages that are somehow “broken” a copy of your home page (with your ads) can appear in a frame on your proxified pages.
First, we’ve set up a test page with a “broken” link that you can use to see if your site has this problem. Cut and paste the URL below;
http://www.webproxyblog.com/test.html
If you can see your site and your ads on it, then you have a potential problem and you should follow the instructions on how to fix this below.
Firstly, download and make a backup of your index.php file. Then open it in a plain text editor such as notepad.exe and look for the following code;
function show_report($data)
{
include $data['which'] . ‘.inc.php’;
exit(0);
}
This is the part of the script that shows your ads. To make your Adsense ads only appear on your homepage, change this part of the script to;
function show_report($data)
{
if ($_SERVER["QUERY_STRING"] == “”){
include $data['which'] . ‘.inc.php’;
}
exit(0);
}
What this script mod does is only allow your ads to appear on your homepage. This will stop Google ads appearing on proxified pages and will hopefully be enough to get your account restored. The problem here is that if a user makes a typing mistake and/or tries to open an invalid URL, then they will see a blank page – not good for your visitors!
You can go one step further to prevent this by making a further modification, replacing this code (but it’s a bit trickier to implement;
if ($_socket === false)
{
show_report(array(‘which’ => ‘index’, ‘category’ => ‘error’, ‘group’ => ‘url’, ‘type’ => ‘internal’, ‘error’ => $err_no));
}with
if ($_socket === false)
{
show_error_report(array(‘which’ => ‘index’, ‘category’ => ‘error’, ‘group’ => ‘url’, ‘type’ => ‘internal’, ‘error’ => $err_no));
}
and you will need to create a new function with the code below;
function show_error_report($data)
{
include $data['which'] . ‘.inc.php’;
exit(0);
}
If anyone needs any further help or explanation or has a better solution, be sure to leave us a comment!
May 27th, 2011 at 3:15 pm
I dont touch Google Adsense at all since they disabled my account…. twice! No wonder there constantly sending out free vouchers for Adwords, its cus they make so much money scamming people
May 27th, 2011 at 6:52 pm
Hi Proxy.
Well I’ve reapplied but I’ve not heard anything. Interestingly enough my ads are still showing though.