View Full Version : Can I IP Ban?
grudziegirl
03-13-2003, 07:03 AM
I have a question that I desperately need an answer to...
Is it possible to ban certain IPs from viewing my website using JS or, actually, using ANYTHING?
It's very important that I ban a handful of troublesome users from my site but I have no idea how to go about it.
First I'd like to know if it's possible...and then I'd appreciate any help in actually making it happen.
Thank you so much for your time and I'd really appreciate any help!
Skyzyx
03-13-2003, 07:06 AM
You'd have to use a server-side language to do it... PHP, ASP, or SHTML should do the trick. I'd drop into one of those forums and ask. I'm sure you'll find the answer there, as JavaScript isn't capable or intended for stuff like that...
grudziegirl
03-13-2003, 07:07 AM
Thanks =)
Philip M
03-13-2003, 07:37 AM
In fact it is perfectly possible to ban identified users from your site using Javascript, but that will only work if they have Javascript turned on in their browsers. In other words, they can get round it. So you cannot stop them viewing the site with Javascript.
You say they are "troublesome" - if by that you mean they submit forms which are improper, you can certainly prevent that, as you can use Javascript to write the <form> tag.
Perhaps you could indicate exactly what you mean by "troublesome".
Spookster
03-13-2003, 09:29 AM
Phillip, how do you figure it is possible to ban an identified user on the site using javascript?
Crossposted:
http://codingforums.com/showthread.php?s=&threadid=16246
Quiet Storm
03-13-2003, 03:42 PM
I've seen it done before, but the JS ban only worked on NS#...
beetle
03-13-2003, 04:10 PM
Other than server-side, I've only seen javascript + SSI. I know that NS has a proprietary thingie (that QuiteStorm mentioned) but that would reach far less people than just regular javascript users.
Philip M
03-13-2003, 06:55 PM
Originally posted by Spookster
Phillip, how do you figure it is possible to ban an identified user on the site using javascript?
Crossposted:
http://codingforums.com/showthread.php?s=&threadid=16246
I stop undesirables posting ads on my site with:-
function bannedguys(which) {
var banned = new Array ('bannedguy1','bannedguy2', bannedguy3');
var emailadd = which.value;
for (i = 0; i < banned.length; i++) {
if (emailadd.indexOf(banned[i]) != -1) {
alert ("Sorry, You are not permitted to post an ad from\nthat email address without obtaining clearance in advance. ");
document.adinputform.reset();
var blank="VOID";
which.value=blank;
which.focus();
document.adinputform.RealName.style.background='black';
which.style.background='black';
return false;
}
}
}
but of course that only prevents them from submitting a form from a defined (and banned) email address. Nor does it stop them from viewing the page.
As I say, it depends on what is meant by "troublesome" but I interpret that to mean persons submitting some sort of form with inappropriate content. I don't see how they are "troublesome" just by viewing the page.
I used to get a lot of rubbish posted on my classified ads site - nowadays hardly any get past a combination of word filters and banned addresses (including @yahoo.com and @hotmail.com - the worst offenders).
joh6nn
03-13-2003, 07:35 PM
those'd be email addresses, not ip addresses. javascript can't ban based on ip. i believe NS4 had a mechanism for this, that somehow involved using java and javascript together, but i don't know how it worked, if at all, and to the best of my knowledge, it's been removed from NS6.
if you have server side includes, you can use a combination of that and javascript to do ip banning fairly easily, but javascript doesn't have its own mechanism for retrieving an ip address, so it's impossible to do it with just javascript.
Spookster
03-13-2003, 07:41 PM
Originally posted by Philip M
I stop undesirables posting ads on my site with:-
function bannedguys(which) {
var banned = new Array ('bannedguy1','bannedguy2', bannedguy3');
var emailadd = which.value;
for (i = 0; i < banned.length; i++) {
if (emailadd.indexOf(banned[i]) != -1) {
alert ("Sorry, You are not permitted to post an ad from\nthat email address without obtaining clearance in advance. ");
document.adinputform.reset();
var blank="VOID";
which.value=blank;
which.focus();
document.adinputform.RealName.style.background='black';
which.style.background='black';
return false;
}
}
}
but of course that only prevents them from submitting a form from a defined (and banned) email address. Nor does it stop them from viewing the page.
As I say, it depends on what is meant by "troublesome" but I interpret that to mean persons submitting some sort of form with inappropriate content. I don't see how they are "troublesome" just by viewing the page.
I used to get a lot of rubbish posted on my classified ads site - nowadays hardly any get past a combination of word filters and banned addresses (including @yahoo.com and @hotmail.com - the worst offenders).
oh ok. I thought you were referring to banning by IP addresses using javascript which is pretty much ineffective since users are assigned new IP addresses very often.
Although banning by email address using just javascript is not going to be very effective for a persistent person. They can just type in any email address they want to. Now if you were to use a server-side application to verify the email address before they could post then that would be more effective.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.