Forum Moderators: open
I have read the forum and came across this script for ip banning with javascript
I tried it, but unfortunately was banning everyone LOL
Problem I have is I have a journal on Example.com and so cannot use my .htaccess file I have already got setup on my own domain. So the only way I can see to ban a particular range of IP addresses is by using javascript on my html template at example.com.
Here is the code I found on here.. I'd really appreciate it if someone could tell me what I"m doing wrong?
Thanks
Anne
<!--#if expr="${REMOTE_ADDR} = /^24.55./" -->
<script language="javascript">
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.example2.com" } else { ("OK your choice, doesn't matter to me! SeeYa!"); {location.href="http://www.example3.com" }}
</script>
<!--#endif -->
[edited by: rogerd at 6:20 pm (utc) on Aug. 10, 2004]
[edit reason] No URLs, please... [/edit]
The clue is in the first line of the script - that looks like PHP code, everything between the <SCRIPT> and </SCRIPT> tags is the JS.
Do you know about the .htaccess file? If your control panel has a link for "Edit HTACCESS" or similar, you can use that to enter:
deny from 1.2.3.4 (obviously use the real IP address here)
Which will return an error for attempted access for that single IP address.
There's some very good HTACCESS info around in another of the forums here - just search for it.
Good luck.
I actually have already setup the .htaccess file to ban this person / ip (I run a forum / weight loss site and this person is the only one that uses that IP so I know I can comfortably ban the ip without losing legitimate users)
That's good for my own domain using the .htaccess file, but where I have my personal journal, it's with example.com (3rd party site) therefore I am not privvy to using things like .htaccess etc.
I know I can move my stuff over to my own domain, but must admit I like the way example.com is setup BUT if I can't write an entry without this person copying / pasting it in emails along with her own comments that are to be blunt, rude, insulting and very abusive.. arrggh
anyway, in short, can you link to an .htaccess file from outside the domain?
[edited by: rogerd at 6:49 pm (utc) on Aug. 10, 2004]