Note: This post was written when I was still using my own WordPress commenting and blogging system.
Ever get those annoying people who access your website and continuously spam your comments section? Who knows, it's possible that I've been getting some pretty stupid spam comments... so I want to block them from ever commenting again.
Well I wipped together a nice little PHP IP blocking script. It accepts wildcards too! The spammer that's been trolling me has commented with three of four different IP addresses, so I'm just going to use a wildcard to keep him out for good. We all know how easy it is to get around IP blockers, but this is at least a good start!
Well that wasn't so hard was it? Well how are you gonna use this function? Well, what I did was put it at the top of my wp-comments-post.php file, so that whenever the malicious users try to post a comment, it will prevent them from completing the submission. Here's a more basic example: