All Proxy Owners Look Here!

Discussion in 'Scripts' started by mubin, Oct 30, 2006.

  1. #1
    Hey all,

    Well we all know how much of a problem hotlinking can be. With proxy sites it's even worse! This mod prevents hotlinking in all cases, saving you tonnes of bandwidth, and helping prevent illegal material viewing at the same time.

    Description: The MOD checks firstly to see if only an object is being proxied (i.e. image, swf etc), if this is the case, it will check to see if the referer is from outside your website, if so, it will simply redirect to a page of your choice (homepage by default). And tada! That's it, this will prevent ANYTHING from being hotlinked through your proxy.

    Version: 1.1

    Installation: Simply copy and paste the mod code into your index.php page, just below the '<?php' at the top of the page.

    /* 
    PHProxy bandwidth MOD 1.1 by Rhett Canney (Billy Connite) 
    This MOD will stop any hotlinking via PHProxy, even if the 
    clients referer is not set! 
    Check out proxywebsite.org if you want to try hotlinking. 
    */ 
    
    // 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(); 
        } 
      } 
    
    /* 
    END MOD 
    */  
    
    PHP:
    All the credit goes to BillieCOnnite at NamePros, for the original Thread go here:

    http://www.namepros.com/free-resour...te-owners-look-here.html?highlight=hotlinking
     
    mubin, Oct 30, 2006 IP
  2. DonKon

    DonKon Well-Known Member

    Messages:
    1,033
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    130
    #2
    thanks, already got it saved somewhere, not using it yet though, need to even out my stats then ill implement this. Overall its a good script everyone should consider implementing into their proxy sites ;)
     
    DonKon, Oct 30, 2006 IP
  3. tweety

    tweety Peon

    Messages:
    397
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanx bro.it is so useful,if working
     
    tweety, Dec 14, 2006 IP
  4. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #4
    It works. Oh yes!!!
     
    login, Dec 14, 2006 IP
  5. SteveAR

    SteveAR Well-Known Member

    Messages:
    2,692
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    160
    #5
    same Q here , doesnt the new version stop this already?
     
    SteveAR, Apr 9, 2007 IP
  6. mubin

    mubin Notable Member

    Messages:
    3,434
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    240
    #6
    Yea, Im pretty sure on php 0.5 you get automatic hotlink protection, or you can turn it on.
     
    mubin, Apr 9, 2007 IP