Hey all, I've posted this on various other forums, so I though I might as well plonk it here too . Sorry if I put this in the wrong section also! I'd noticed a huge increase in my proxy sites traffic suddenly. This is because people are using proxies to hotlink images off your proxy sites (mostly porn, HEAPS OF BANDWIDTH!!!) So to prevent this hotlinking, you can use the code I made for myself, which can save you loads of bandwidth... Just place the code written below - ABOVE all the code in the index.php page. (make sure its after the '<?php' tag though) /* PHProxy bandwidth MOD by Rhett Canney (Billy Connite) This MOD will stop any hotlinking via PHProxy, even if the clients referer is not set! Check out ProxyWebsite.com if you want to try hotlinking. */ // Change this to your domain (no 'www.') $domain="proxywebsite.com"; // If no request: if($_GET['q']!=""){ // Get referer $referer=$_SERVER['HTTP_REFERER']; // Check to see if referer is not the proxys domain $count=substr_count($referer,$domain); // If there is an outside referer: if($count==0){ // If there is a request: if($_GET['q']!=""){ // Redirect to homepage and finish script header("Location: http://www." . $domain . "/"); exit(); } } } /* END MOD */ PHP: The code checks to see if there is only an object (image, swf etc) being requested by a referer that is not your site. If it finds that an only an object is being requested, and no html, it will redirect straight to the homepage of your site. This prevents any files being hotlinked! Just thought i'd share it with you all Best of luck, Rhett.
Also this does not have a provision to check for approved hotlinkers, like top proxy sites and proxy directories that are checking to see if your proxy is alive through their scripts.
Oops, can't edit that out, DigitalPoint forums won't allow it. Proxy topsites will not be a problem at all, this script will only stop proxied things be hotlinked, not images or other code sitting on your server, so proxy top sites work just fine mate. If you want to allow certain hot linkers to hotlink via your proxy, then use this script: /* PHProxy bandwidth MOD by Rhett Canney (Billy Connite) This MOD will stop any hotlinking via PHProxy, even if the clients referer is not set! Check out ProxyWebsite.com if you want to try hotlinking. */ $domains[]="www.yoursite.com"; $domains[]="yoursite.com"; $domains[]="www.proxy.org"; $domains[]="proxy.org"; // Get referer $referer=explode("/",($_SERVER['HTTP_REFERER'])); // Check to see if referer is not the proxys domain // If there is an outside referer: if(!in_array($referer[2],$domains)){ // If there is a request: if($_GET['q']!=""){ // Redirect to homepage and finish script header("Location: http://www.someaddress.com/something.html"); exit(); } } /* END MOD */ PHP:
I know this is an old thread ... But will this code work in phproxy 1.5, the latest version? Anyone tried it? If not, is there an alternative snippet of code that will save my bandwidth? Thanks.
It should work with new versions, i just tested on my proxy, it gives no errors so thats a good thing imo Tyler
This works i was doing some more testing, such as trying to hotlink my own pages, one of my proxies was using over 80gigs per day, lets see if it dies down after implanting this into that proxy aswell Thanks again its awesome Tyler