Proxy sites, always consume a lot of bandwidth and of course will make your proxy run slower, especially when your proxy sites its very popular. Hot linking can be one of the reason that your proxy sites consume allot of bandwidth. Here is the solution. Its just add-on script that you can copy and paste in your index.php file.
Here is the code :Â (paste this code in to index.php at the begining of the code in the php tag)
//===========================================================
// allow hotlinking from these sites, seperate by comma (make sure you eneter your site’s domains)
$domains=”www.yourdomain.com,yourdomain.com”;// convert domains into an array
$domains=explode(”,”,$domains);// if there is a request:
if($_GET['q']!=”")
{
// get referer
$referer=explode(”/”,($_SERVER['HTTP_REFERER']));
// if the referer is not allowed:
if(!in_array($referer[2],$domains))
{
// redirect to homepage and finish script
header(”Location: http://”.$domains[0].”/”);exit();
}
}
//===========================================================
Just change the “yourdomain.com” into your proxy domain. With this code, all the referrer if not from your domain, will be redirected to your main page, this way it can prevent hot linking. Enjoy and have fun.
Posted November 4th, 2007 by admin This entry was posted on Sunday, November 4th, 2007 at 2:57 pm and is filed under Webmaster Tips. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

















Leave a Reply