View Single Post
  #2 (permalink)  
Old 04-04-08
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,999
Thanks: 0
Thanked 18 Times in 18 Posts
tbp is an unknown quantity at this point
  Re: Block a site from accessing mine

Yes, could do it through PHP. The page referrer if it exists is held in $_SERVER['HTTP_REFERER']

So you could use the following:

Code:
if(substr_count($_SERVER['HTTP_REFERER'],"dodgysite.com") > 0){
  header("Location: you_cant_view_this_site.php");
}
It would be better to do it at the web server level, but you probably won't be able to access the apache config. If you can you can do it using mod_rewrite.
Reply With Quote