Certainly! Referring to the post you linked, do the following:
1. Same. If you already have captcha on your add form, skip this step.
2. Edit
rate.cgi, sub main as shown:
Code:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;
if ($in{'rate'}) {
# >>> Captcha Mod next line
($in{'captcha'} ne '') ? &captcha : &site_html_rate_failure("You did not enter the security code.") and return; # <<< }
elsif ($in{$db_key} =~ /^\d+$/) {
my (%rec) = &get_record ($in{$db_key});
($rec{$db_key} eq $in{$db_key}) ?
&site_html_rate_form (%rec) :
&site_html_rate_failure ("Unkown Link ID: $in{$db_key}");
}
else {
print "Location: $build_ratings_url/\n\n";
}
}
3. Add this new sub to
add.cgi, above
sub rate_it:
Code:
sub captcha {
#------------------------------------------
require "admin/captcha/captcha.pl";
$code = ($in{'code'});
$crypt = ($in{'crypt'});
if ($code && $crypt){ # check code
$result = &checkCode($code,$crypt); if ($result == 1){
&rate_it;
}
elsif ($result == -1){
&site_html_rate_failure("<b>Failed!</b> Reason: code expired. Possible cause: code was issued too long ago. Try the new code below.") and return;
}
elsif ($result == -2){
&site_html_rate_failure("<b>Failed!</b> Reason: invalid code (not in database). Possible causes: code already used or expired. Try the new code below.") and return;
}
elsif ($result == -3){
&site_html_rate_failure("<b>Failed!</b> Reason: invalid code (code does not match crypt). Possible cause: characters not entered correctly. Try the new code below.") and return;
# note - once a solution is tried it is expired, even if it failed
}
else {
&site_html_rate_failure("You did not enter the security code.") and return;
}
} } # end sub 4. Edit the rate routines as shown for the add routines.
5. Add this routine if you do not already have it for the add form. This one routine will run the Captcha for both add and rate (and any others).
6. Make these edits in the rate templates.
That should do it for ya!
Leonard
aka PerlFlunkie