View Full Version : Blocking/Restricting hyperlinks from certain domains?

12-21-2006, 11:39 PM
Ok, I basically need block ALL visitors coming from certain locations, as the website I work for's population is mainly kids and young teens. So yeah, you see my problem. I would really like to keep them all as safe as possible. One of the main things I'd like to do is block access to it from the 4chan websites, as well as a couple of others. If you know of 4chan, you know why, if not, then assume 4chan is no good. So anyway..

All I really know on this subject is $_SERVER['HTTP_REFERER'], which returns the referral URL, if there is one. BUT, is there a way to block from all locations on a single website? And if so, how?

Thanks in advance!

12-22-2006, 02:54 PM
What you're looking to do could get pretty complicated and if made too stringent, you may end up throwing the baby out with the bathwater.

First thing to think about is there's no way to block someone who has visited another website.

One way of coming close is to get the referer and log the IP address of the user who came from that site. And then, in the future always block that IP address from viewing your site. But, that's where you can end up blocking legit users too since IPs can change owners frequently. Generally, IP blocking is a bad idea.

Otherwise I, personally, don't know of any slick way of doing this.

12-22-2006, 08:48 PM
A lot of people have the referrer field turned off in their browser or firewall in order to protect their privacy. There is no way to tell where a visitor came from if they don't want to tell you.