Scott wrote:
my $c = Captcha::reCAPTCHA->new;
$template->param(CAPTCHA => $c->get_html( 'mypubkeyitookout' ));
my $result = $c->check_answer(
'myprivkeyitookout', $ENV{'REMOTE_ADDR'},
my $challenge = $query->param("recaptcha_challenge_field"), my
$response = $query->param("recaptcha_response_field")
);
if ( $result->{is_valid} ) {
print "Yes!";
}
else {
# Error
my $error = $result->{error};
}
ok i managed to get this to load, now is there a way to make the print
yes load a page? when i hit submit it goes to an error. of
[Wed Jun 24 12:05:55 2009] [error] [client 192.168.1.5] Use of
uninitialized value in concatenation (.) or string at MinimalApp.pm line
22., referer: http://192.168.1.9/cgi-bin/index.pl?rm=registration
[Wed Jun 24 12:05:55 2009] [error] [client 192.168.1.5] Use of
uninitialized value in concatenation (.) or string at MinimalApp.pm line
24., referer: http://192.168.1.9/cgi-bin/index.pl?rm=registration
[Wed Jun 24 12:05:55 2009] [error] [client 192.168.1.5] Error executing
run mode 'index': HTML::Template : Attempt to set nonexistent parameter
'captcha' - this parameter name doesn't match any declarations $
[Wed Jun 24 12:05:55 2009] [error] [client 192.168.1.5] at
/usr/lib/cgi-bin/index.pl line 4, referer:
http://192.168.1.9/cgi-bin/index.pl?rm=registration
[Wed Jun 24 12:05:55 2009] [error] [client 192.168.1.5] Premature end of
script headers: index.pl, referer:
http://192.168.1.9/cgi-bin/index.pl?rm=registration
which im assuming its creating a captcha and i just need to handle it.
ill get this i think im close.
ef sorry, ive narrowed my error down to
$template->param(CAPTCHA => $c->get_html( 'mypubkeyitookout' ));
It does not like that if your on index but on registration page it does.
Is there an easy way to do like a $self->param for the registration page
so when you go to the index page it doesnt see anything about captcha
but on the registration page it knows what captcha is?
something like this, but i prolly need to pass stuff into it.
sub registration{
my $self = shift;
my $query = $self->query();
my $c = Captcha::reCAPTCHA->new;
$self->param(CAPTCHA => $c->get_html(
'6LeSCwcAAAAAAFmq4fJH8D_X9Z44-M7cPESHrogT' ));
my $result = $c->check_answer(
'6LeSCwcAAAAAAGh8Yf8kUC6obsRZpLdk5PEeZJS1', $ENV{'REMOTE_ADDR'},
my $challenge = $query->param("recaptcha_challenge_field"), my
$response = $query->param("recaptcha_response_field")
);
if ( $result->{is_valid} ) {
print "Yes!";
}
else {
# Error
my $error = $result->{error};
}
return $self->processtmpl('intranet/registration.tmpl');
}
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/