I need Code Help. URL Referral Blocking / Domain Blocking / IP Blocking on my web pg
Someone once posted my URL on their Yahoo! Profile page, someone I didn't want to communicate with. I needed a code to redirect my page to go somewhere else only when it came from that page. Some taught me this code:
Here's a little javascript I just wrote for you. Remember to surround this with script tags and within the head section of your html doc. and change the values of the variables to the URL that is linking to you (BLOCKED_URL), and the URL you want to forward those visitors to (FORWARDING_URL)
var BLOCKED_URL = 'http://profiles.yahoo.com/yahooID';
var FORWARDING_URL = 'http://www.yahoo.com';
if(document.referrer==BLOCKED_URL)
{
location.href=FORWARDING_URL;
}
var BLOCKED_URL = 'http://profiles.yahoo.com/yahooID';
var FORWARDING_URL = 'http://www.yahoo.com';
if(document.referrer==BLOCKED_URL)
{
location.href=FORWARDING_URL;
}
Next, earlier this week, I've got someone harassing me - on purpose - by continuously posting my URL's on a particular forum (let's call it http://forums.thesite.org ). The admin has removed the posts 4 times already and has recently blocked his domain for a few days.
One thing I've done about this is set up the HTML code (in all my files, this was quite tedeous) as follows:
<script language="JavaScript">
var b = 'forums.thesite.org';
if (document.referrer.indexOf(b)!=-1){
location.href='http://www.a_404_page_location.net/';
}</script>
var b = 'forums.thesite.org';
if (document.referrer.indexOf(b)!=-1){
location.href='http://www.a_404_page_location.net/';
}</script>
Now for my specific questions and what I need help on:
Questions
1) If I know the domain of the individual that going to my page ( i.e. www.ISP_Provider.net ), how can I create a code such that anytime an individual who's ISP is www.isp_provider.net , to reject and completely block my site from this domain? That way, since we know his domain, we can prevent the abuser from accessing my site from his home.
Of course, would not do this with aol, etc., but this is a unique domain, so unique that the forum site has completely block this domain for a short while. I would like to block this domain completely.
If someone is using www.ISP_provider.net as their ISP, they can't access my page, period.
2) Currently, as noted above, I'm able to reject anything coming from http://forums.thesite.org and redirecting it to a page not found page.
If I know that the IP address of http://forums.thesite.org is, for example, 34.234.23.34 , how can I write a code to block all links to my page coming from that area?
I'm currently blocking all links from
'forums.thesite.org'
but I want to block the same way using an IP address instead.
Thanks in Advance