Programmatically add IP to Blacklist?

Permalink
Is there a way to do this in code?

ideasponge