Block ip in php forms

On my contact page on my site, I found a nice script to send emails, but, for the future I want to prevent spammers and/or "haters" from cluttering my inbox. I'm new a php and can only so far edit and add to it, not write it, so I was hoping that someone knows of a script/knows how to write this basicly;

if ip xxx.xx.visitor "sends" +3 within timeframe = deny

and I'm thinking that it would require some MySQL additions to store the IP and hit times... or some sort of write-to-log.txt file...

?

#474850

Hmm, I've used this before. It's not exactly what you want, but I don't really know how much spam you'll be getting ;).

http://jimsun.linxnet.com/SCForm.html

#474881