Friday, October 30, 2009

Block countries from your website

Ever wish you could block certain countries from your web server? I have. Sometimes it seems like all the hackers live in one place. I came across this website today that will create an .htaccess file for your web server. You can block any number of countries from your website based on their IP addresses. It cannot prevent determined people from using VPNs or proxies, but it works as a first line.

Wednesday, October 14, 2009

jQuery, checkbox status

I wanted to find the state of a checkbox and hide or show some text using jQuery. The thing that I got stuck on was determining if the checkbox was checked. This is how I ended up doing it:

<script type="text/javascript">
$(document).ready(function() {
$("input[name='cbname']").click( function() {
if ($(this).attr('checked'))
<input type="checkbox" name="cbname"> Hide!
<div id="text">
Disappearing Text

Simply checking the attribute 'checked' of the checkbox returns its state (in jQuery 1.3.2, at least).