cl-recaptcha is a simple interconnection between recaptcha.com and common-lisp. It can be used for the trivial usage of the recaptcha service.
cl-recaptcha require split-sequence and drakma. I currently load it through clbuild (you’ll have to add it to wnnp-projects) to handle the dependencies.
The simplest way to use cl-recaptcha is to get a public and private key from recaptcha.com. Set the key in cl-recaptcha, insert the needed code in your site and ask cl-recaptcha for verification. All this should look somewhat like this:(setf cl-recaptcha:private-captcha-key “your-private-key”) (setf cl-recaptcha:public-captcha-key “your-publick-key”)
In the source of the page, insert a call to challenge where you want to have your recaptcha inserted.(challenge)
Assuming you get your post-vars by (get-post-var “varname”) and the ip of the user by (get-ip-address), you can check the validity of the entry of the user by running:(verify-captcha (get-post-var “recaptcha_challenge_field”) (get-post-var “recaptcha_response_field”) (get-ip-address))
which will return T on success and nil on failure. The second value it returns tells you something about the reason of failure.