Forum Moderators: open

Message Too Old, No Replies

IP banning

this was posted a few months ago

         

prolifik

8:54 pm on Feb 8, 2005 (gmt 0)



There was a thread posted awhile ago that will not let me reply to it.

[webmasterworld.com...]

It shows two working codes for banning an IP address using javascript.


<script language="javascript">
// ip Redirect
var ip = '<!--#echo var="REMOTE_ADDR"-->' // ** Do Not Modify This Line **
if (ip == '00.00.00.00') {
alert("ACCESS DENIED!");
if (confirm("You are not authorized to view this web site!"))
{location.href="http://www.example.com/security.html" }
else
{ ("ACCESS DENIED!");
{location.href="http://www.example.com/security.html" }} }
</script>

OR

<script type="text/javascript">
// ip Redirect
var ip = '<!--#echo var="REMOTE_ADDR"-->' // ** Do Not Modify This Line **
if (ip == '00.00.00.00') {window.location.replace("http://www.example.com/security.html")
}
</script>

I cannot get these to work. I've tried both. I've moved them around; before and after <html> or <body> but no luck. I'm also using a free message board style service that runs on asp. Could this be causing my problem?

Edit: Now that I look at it, the server probably doesn't allow SSI (Server side includes)

orion_rus

10:31 am on Feb 9, 2005 (gmt 0)

10+ Year Member



echo var="REMOTE_ADDR"
it's a server side programming. if u didn't up any server side scripting languages it wouldn't work.

I think you can obtain IP address with Javascript only if java machine is up. But much users didn't have it. And better way to obtain ip address with a server side programming)

prolifik

8:46 pm on Feb 9, 2005 (gmt 0)



what if i wanted to disallow a certain user name?
For example, on my site, and user enters their name and may leave a comment. Obviously they can just change their name to something different and get it to work, but sometimes you just don't want to see that annoying person's user name. Any way to do this?

Bernard Marx

10:58 pm on Feb 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup. Easy enough, but you'll have to give use some idea of how you are dealing with the username input to start with.

It will just be a simple matter of comparing the input boxe's value with a hrad-coded string, and possibly redirecting.

Meanwhile, about the first post, did you try saving the page with the extension: .shtml
?

"Runs on ASP" - Can you create these ASP pages yourself on your host?

prolifik

2:43 am on Feb 10, 2005 (gmt 0)



No we can't make new pages.
In the comment block there is this code:

<div class="commentblock" id="<bloghorn:templates:comment:id />">
<bloghorn:templates:comment:delete:button />
<bloghorn:templates:comment:time />
<b><bloghorn:templates:comment:url:orname /></b>
<bloghorn:templates:comment:admin>
(<bloghorn:templates:comment:ipaddress />)
</bloghorn:templates:comment:admin>

<hr>
<table>
<tr>
<td valign=top><bloghorn:templates:comment:image /></td>
<td valign=top><bloghorn:templates:comment:text /></td>
</tr>
</table>
</div>
<br/>

bloghorn is the service i'm using.
id="<bloghorn:templates:comment:id />"> may be what I'm looking for.