Web Hosting Talk







View Full Version : I need Code Help. URL Referral Blocking / Domain Blocking / IP Blocking on my web pg


wf19
12-05-2002, 01:13 AM
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;
} The above was placed into the HTML code and worked perfectly.

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>With this, anytime someone clickes on any of my pages that's posted anywhere on the forum http://forums.thesite.org/**** - including all downstream files and directories - it would not go to my page and would re-direct to a 404 page error page. This has been working perfectly also, but I do have to enter this HTML code into each and every file.

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

MarkIL
12-05-2002, 01:43 AM
As for #1, ask your hosting provider to drop requests from that domain. You mentioned earlier that they use IIS, so I have no idea how that's done w/that daemon.

#2 Isn't feasible, unless the referrer field is the IP address and not the domain.

DigiCrime
12-05-2002, 01:56 AM
Possible to just add a deny access from statment in .htaccess ?

MarkIL
12-05-2002, 01:59 AM
Originally posted by DigiCrime
Possible to just add a deny access from statment in .htaccess ?

His host uses IIS.

wf19
12-05-2002, 02:03 AM
Originally posted by (geektalkforummember)
the code you need to add to .htaccess.Thanks, I have a question about .htaccess

I'm not sure what that is. I'm knowledgeble about HTML.

I don't know javascript, but know how to copy/paste codes where and when I need them in the HTML document.

Is .htaccess codes that can be placed into the HTML code? If it's outside and something to do with the server, it might not be accessable to me and only my host can handle that part.

DigiCrime
12-05-2002, 02:13 AM
oh, sorry bout that, in the console you can allow/deny from there, cept if you have no access to it im not sure id have to look for the procedure right off hand

Thanatos
12-05-2002, 03:03 PM
Originally posted by wf19
Is .htaccess codes that can be placed into the HTML code? If it's outside and something to do with the server, it might not be accessable to me and only my host can handle that part. .htaccess is a file named .htaccess with server commands and directives. So it applies to an entire directory, not just one file.
.htaccess works on server level, not on client level.
If the clients browser doesn't support javascript he will still be able the see your site.

rp777
12-05-2002, 08:20 PM
Without admin access, the access methods - .htaccess, etc won't be something you can do. If asking the host is unfruitful, why not wrap your pages in a perl(e.g.) script that fetches a 404 page if HTTP_REFERRER matches a list of names or IP's you want to dump? This would not come from the client, so their java settings shouldn't matter, eh?