PDA

View Full Version : can this be done? using javascript to block user IP?


Michael
11-20-2002, 10:49 PM
hi
one of my friend's guest book is being attacking by some spammer, the spammer leave unproper words on his bravenet guest book and the spammer set the font site to over 400 so even an edge of a character is larger than a screen

well... since bravenet guest book allow people to edit his/her own html code... is there any way to ban an IP from viewing a site by using Javascript?

thanks in advance

scoutt
11-21-2002, 08:57 AM
short answer.. no

javascrpipt is client side so they can turn it off. best suggestion is to get his own guestbook and stop using a free one. then you could do it serverside

Diamax
11-22-2002, 08:33 AM
Hi Michael!

Check this link:

http://www.jsmadeeasy.com/javascripts/User%20Details/IP%20Address%20Filter/index.htm

Check This One Too For More Info:

http://www.jsmadeeasy.com/javascripts/User%20Details/list.htm

That's for Netscrape, if you find a solution for IE please let me know. I would appreciate that. THANK YOU!!

Ciao!! and Good Luck!!

The Quinn
11-22-2002, 03:41 PM
This works in IE, put this script in the header.
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
var bannedip = '12.345.67.890'
if (ip == bannedip) { location.href = 'getlost.html' }
</script>
change the value for bannedip to the ip address of the person you want to ban, so if their address is 40.331.56.098 the line will read var bannedip = '40.331.56.098'
Also change getlost.html to the address of the page you want them to be taken to instead.

To ban two addresses, the script would look like this.
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
var bannedip = '12.345.67.890'
var bannedip2 = '09.876.54.321'
if (ip == bannedip) { location.href = 'getlost.html' }
if (ip == bannedip2) { location.href = 'getlost.html' }
</script>
Like scoutt said, if the visitor disables javascript in their browser then this won't work, but to be honest most users wouldn't realise how to get past it. If you wanted to be really secure you'd need something serverside, but this should sort out the vast majority of people.

Michael
11-25-2002, 06:40 PM
cool script, I never thought Javascript has so many build in function...

thank you The Quinn and other who helps, great script!

DimplesComic
09-01-2003, 04:13 PM
Hi the exact same thing is happening to me and IM not happy about it. Ive got a partial IP adress actually, from my site meter, if I use a * for the missing number sequence, will it ban all people with IPs similar to that ? I dont care, I just want to ban this pervert....you
cant imagine what hes been doing.

Michael, what sort of stuff did this guy do to your friend ? Maybe its the same sorry a$$ed loser....


But my question is, how do I stick the Javascript in there? Just between <body></body> and it automatically stops him ? or does he have to click something first to be banned ?

~FRUSTRATED! :mad:

DimplesComic
09-01-2003, 04:41 PM
204.210.198.# Here is his ip, I dont have teh last 3 numbers. How many possibilities could it be ? I have site meter, but it wont give you the last IP unless u subscribe. *#($(#*$@#~ :mad:

hpteenlife
09-01-2003, 05:57 PM
Bravenet also offers free IP address blocking, so you can block certain IP addresses from using any of their services.

DimplesComic
09-01-2003, 07:46 PM
aghh, I cant find that service on their site, do you know the link to find it ?

scoutt
09-01-2003, 08:41 PM
Originally posted by DimplesComic
204.210.198.# Here is his ip, I dont have teh last 3 numbers. How many possibilities could it be ? I have site meter, but it wont give you the last IP unless u subscribe. *#($(#*$@#~ :mad:
how many possibilities? try 255.

DimplesComic
09-01-2003, 11:24 PM
Theres alot actually apparently from 1-255 :(

scoutt
09-02-2003, 12:38 AM
isn't that what I just said? and it is 0-255

agent002
09-02-2003, 11:43 AM
The Quinn's script requires SSI, which is serverside.

DimplesComic
09-02-2003, 06:12 PM
I am pleased. The guest book people gave me is full IP. Its 97, which is the missing numbers. So now I can ban him, using Java, and if THAT doesnt work, Ill report the bast--d...thanks for ur help everyone.:rocker: