Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Bandwidth MOD

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch
Bandwidth MOD

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.

PHP:
/*
Bandwidth MOD 1.1
*/

// 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
*/
Best of luck
 
Last edited:
17
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Giving this one a bumpage :tu:
 
0
Close
I just used this and it works great, just what I was looking for. Rep+ for Rhett and Eric, for both of their contributions.
 
0
Close
0
Close
thank you very much for the great help.

thanks i would also be waiting for your next mod. with something new.

have a nice day
 
0
Close
Last edited:
0
Close
BillyConnite said:
Well, a new version of phproxy came out a little while ago :), so I guess it's time for me to check and update this little mod heh.

Reporting back soon.
I think it has something for hotlinking already built-in.
 
0
Close
Last edited:
0
Close
Hi,
Still think your code may be usefull for other sites, not just PHproxy.

By the way, isn't the same thing achievable with .htaccess?

- Vince
 
0
Close
0
Close
SecondVersion said:
.htaccess:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^domain.com$ [NC]
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^(.*)$ http://www.domain.com/ [R=301,L]
Untested, however.

Ah, missed or forgot about that post. :red:
What difference is there to what I found?

Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} . 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com [NC] 
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

Thanks very much.

- Vince
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back