So I've got a weebly site that I'm running but I've got a really annoying troll posting in my comments, I have the trolls IP but I'm not sure if there's a way to block their ip address. Anyone know if I can do this?
There are a number of ways. Can you tell us more about your architecture?
Edit: sorry, read weebly as weekly. Researching...
I'm using Weebly (its hosted on their servers) and I have tried playing around with various Javascripts in the settings/HTML code none of it seems to work I'm not sure if I did it right and I know weebly does not support htaccess. In terms of the actual posting I've got a blog on there and I'm trying to keep the troll out without hindering the actual users with passwords or approval only comments.
If you're running apache, add their IP or their IP range/subnet to the sites-available config for your website. You can also do this using an .htaccess file on pretty much all flavors of web hosting software. For more specifics just google yourself some details on how to do those that are more specific to your setup.
I use the sites-available on my guild website to block out spam bots.
ok, was posting this before you mentioned you can't edit .htaccess
What do you have access to?
http://jqueryhelp.ning.com/forum/top...ain-ip-address
will that help?
dragonmaw - EU
I actually was playing around with this script and was unable to get it to block my ip I was testing with. I don't know if it was my bad implementation or not though.
HTML/CSS, file uploads and Search Engine Optomization, supposedly there is a way to get javascripts to work as well but haven't had any luck.What do you have access to?
yeah if you can add javascript, you could easily add a JavaScript IP based redirect to google or something in the header for the website.
Something like...
<script type='text/javascript'>
var yip2=java.net.InetAddress.getLocalHost();
var yip=yip2.getHostAddress();
if (yip == "troll's ip") {
window.location = "http://www.google.com/";
}
</script>
Only if the spammer isn't technically savvy. It'd be trivial to put a break point in there and jump over that using a debugger.
Unfortunately, I'm not seeing much you can do on Weebly about this as they don't appear to give you that kind of low level control. You might want to try their support though.
Last edited by time0ut; 2013-09-12 at 12:43 AM.
I can edit the header, thing is I've seen some weird ways of implementing the Javascript the way people seem to be doing it although it hasn't worked for me is by uploading a .js file to the HTML/CSS code section and then in the header code using scripts to load the JS libraries and call the file.
- - - Updated - - -
Looks like I'll have to try, maybe I should also try toying with some basic Javascripts just to make sure I'm implementing correctly.
Try something like...
<script type="text/javascript">
alert('test');
</script>
If you did it right, you will see an alert box that says test pop up when you load the page.
If you have control over the HTML, you can put that just about anywhere in the head or body and it should work.
If the user is sitting behind NAT (like a normal router) the browser probably won't know its public IP address. I've only ever seen that part done with a jsonp call to another service.
Also, that java.net thing isn't valid JavaScript. That's why its not working.
Try this:
<script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
<script type="text/javascript">alert(ip);</script>
Last edited by time0ut; 2013-09-12 at 01:20 AM.
Excellent. Then we simply need to combine this with Tradewind's original script like so:
<script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
<script type='text/javascript'>
if (ip == "troll's ip") {
alert('bye bye troll');
window.location = 'http://www.google.com/';
}
</script>
Try it with your IP first to make sure it works of course! If I recall correctly, the link serenka posted above gives an example of how to block multiple IP addresses. You will probably want to upgrade to something like that as many internet users have dynamic IPs that shift periodically. In other words, if your troll is persistent, you will have to ban multiple IPs as time goes on.
Last edited by time0ut; 2013-09-12 at 01:25 AM.