Forum Moderators: mack

Message Too Old, No Replies

How do I Block or Redirect an IP address Using JAVA or HTML

Have a pest I want redirected. I can only use Java or Html

         

wattic

2:59 pm on Feb 22, 2005 (gmt 0)

10+ Year Member



Hi,
I am hoping someone can help me.
I have a pest that I am trying to block from visiting my site. I had served them with a cease and desist order for theft of my work over a year ago and now they are back(same ip as before) just being a pest spending hours on my site just being noisy, I think.
So I want to block their ip address so they just think that my site doesn't exist anymore and hopefully go away.

I don't have the pleasure of being able to create my own .htacess file according to my site host, so I have to do it in JavaScript or html.

I found this code (below) and I like it but for one thing. It blocks ALL ip's including mine.

Please help me fix it so that it will block only the one IP address that I need it too.

************Here is the code I have now(I LIKE how it redirects but it blocks everyone)*********

<!--#if expr="${REMOTE_ADDR} = /^XX.XX.XXX.XXX/"-->
<script language="javascript">
alert("The website you are trying to view has been removed!");if (confirm)
{location.href="http://www.google.com" } else {{location.href="http://www.getalife.com" }}
</script>
<!--#endif-->

*******************************************
This code below I could not get to work for me at all
****************************************

<script language="javascript">
var ip = <!--#echo var="REMOTE_ADDR"-->
if (ip <='XX.XXX.XXX.XX') {
alert("STOP! You are not authorized to access this page!");
alert("Do not attempt to return, or your computer will begin a self-destruct sequence!");
if (confirm("Please leave now Or you will be forceably removed!"))
{location.href="http://www.google.com" } else { ("OK your choice, doesn't matter to me! SeeYa!"); {location.href="http://www.getalife.com" }} }
</script>

Thanks in advance

lZakl

3:10 pm on Feb 22, 2005 (gmt 0)

10+ Year Member



Hello wattic,

Welcome to Webmasterworld!

You don't have the access to an .htaccess file, but are you given a scripting language you can work with. If so, it would be fairly easy to redirect them to a "not authorized" page and the rest of your site users get to see your content. Scripting support will vary. Check to see if they have PHP, PERL, ASP, JSP, or CFM capability. Any of them will do.

Good luck!

-- Zak

wattic

4:21 pm on Feb 22, 2005 (gmt 0)

10+ Year Member



Zak,
Thanks for your help. I called my site provider and was told, that my best bet is to use as javascript that would redirect a spefic ip address.

Do you know of a javascript that will do that without redirecting everyone like what I am using now?

Here is what I have now and it redirects everyone

<!--#if expr="${REMOTE_ADDR} = /^XX.XX.XXX.XXX/"-->
<script language="javascript">
alert("The website you are trying to view has been removed!");if (confirm)
{location.href="http://www.google.com" } else {{location.href="http://www.getalife.com" }}
</script>
<!--#endif-->

Many Thanks

lZakl

12:03 am on Feb 23, 2005 (gmt 0)

10+ Year Member



wattic,

I'd suggest switching hosts. One that would argue the superiority of Javascript over a Server-Side (Behind the scenes) Scripting language is daft. What's to stop the intruder from simply unchecking the "enable Javascript" in his browser? If it were on the server-side, it could not be disabled. It is ignorant to think that a javascript could stop somone from visiting a site if they wanted. For that matter, if they REALLY wanted in, although they would have to go through some trouble, even a server-side script wouldn't stop them. The point is that Javascript is easily disabled and a scripting language cannot be "gotten around". Any host that told me I'd be "better off using Javascript" for this particular application, I'd high-tail away from. But that's just my personal opinion. :0)

-- Zak