12 Replies - 2663 Views - Last Post: 01 July 2009 - 06:15 AM

#1 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

integrate captcha perl script into different perl script

Posted 23 June 2009 - 08:12 AM

I have a website and want to start using Captcha so that a real human must reg and post.

I found a captch script at
http://www.bumblebeeware.com/captcha/

I have 3 place that I need to use the captcha

one is when some one reg at the site
two is the login page

three is the reply to ad link.

I have working on the reply to ad link and here is the code blow. I hope I posted all the code.


but I am missing somthing int he reg code. I can not get it to work.

here is the code can you tell me were i misted up. i am getting this before I even hit submit.

Input verification code does not match the text on the image

This post has been edited by winracer: 24 June 2009 - 06:23 AM


Is This A Good Question/Topic? 0
  • +

Replies To: integrate captcha perl script into different perl script

#2 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 23 June 2009 - 04:01 PM

Sorry winracer here, not sure how to remove this post . but dont take anytime reading this. I have more research to do in were to place the code. the reg script that I post, that I can not get the code to work in has about 4 other scripts tied to it. I will post again when I do my homework on these scripts, if I need help. again thanks for this froum and the great mind, smart people who helps pepole like me.
Was This Post Helpful? 0
  • +
  • -

#3 dsherohman  Icon User is offline

  • Perl Parson
  • member icon

Reputation: 226
  • View blog
  • Posts: 654
  • Joined: 29-March 09

Re: integrate captcha perl script into different perl script

Posted 24 June 2009 - 06:26 AM

Unless you have a specific reason for running BumblebeeWare's captcha script, I would suggest that you take a look at using Captcha::reCAPTCHA to handle it for you. It's well-documented and I found it very easy to set up the first time I used it; it is (IMO) one of the most human-friendly captchas I've encountered, while remaining more-than-adequately machine-hostile; it provides audio as well as image captchas, so accessibility is better than many other solutions; and, best of all, the images are derived from actual scanned documents on which OCR failed, so you're contributing to the cause of digitizing the world's information (plus you know that the text was already beyond computers' ability to identify it even before being mutated for use as a captcha).
Was This Post Helpful? 0
  • +
  • -

#4 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 24 June 2009 - 06:40 AM

View Postdsherohman, on 24 Jun, 2009 - 05:26 AM, said:

Unless you have a specific reason for running BumblebeeWare's captcha script, I would suggest that you take a look at using Captcha::reCAPTCHA to handle it for you. It's well-documented and I found it very easy to set up the first time I used it; it is (IMO) one of the most human-friendly captchas I've encountered, while remaining more-than-adequately machine-hostile; it provides audio as well as image captchas, so accessibility is better than many other solutions; and, best of all, the images are derived from actual scanned documents on which OCR failed, so you're contributing to the cause of digitizing the world's information (plus you know that the text was already beyond computers' ability to identify it even before being mutated for use as a captcha).



thanks dsherohman

No really do not care what captcha I use. I just found the bumbleeware and thought it would be easy to intergrate into my site.

I will review Captcha::reCAPTCHA

and see if I can intergrate it into my site. I have to do something soon I am getting about 20 to 40 bad ads aday that I have to remove.

Have you intergrated Captcha::reCAPTCHA
into a site before? If so would you mind if I posted any questions I my have here?
Was This Post Helpful? 0
  • +
  • -

#5 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 25 June 2009 - 11:32 AM

thanks dsherohman

I asked my hosting company to install the module for
I will review Captcha::reCAPTCHA

and they installed for me I have the Captcha showing on my site useing this code below NOTE: I removed my key information

use Captcha::reCAPTCHA;

	my $c = Captcha::reCAPTCHA->new;

	# Output form
	print $c->get_html( 'your public key here' );






I still am having trouble finding out where to use the check part



# Verify submission
	my $result = $c->check_answer(
		'your private key here', $ENV{'REMOTE_ADDR'},
		$challenge, $response
	);

	if ( $result->{is_valid} ) {
		print "Yes!";
	}
	else {
		# Error
		$error = $result->{error};
	}







any thoughts?

This post has been edited by winracer: 25 June 2009 - 11:33 AM

Was This Post Helpful? 0
  • +
  • -

#6 dsherohman  Icon User is offline

  • Perl Parson
  • member icon

Reputation: 226
  • View blog
  • Posts: 654
  • Joined: 29-March 09

Re: integrate captcha perl script into different perl script

Posted 26 June 2009 - 05:52 AM

Here's the (heavily-edited to remove irrelevant sections) source to a "register" method I've used in the past. It's using HTML::Template to handle output and is set up so that the same method/URL will display the blank form when passed no data, or check the captcha and store the data if data is POSTed to it. (Conceptually REST-like, but based on whether it receives data or not rather than on whether the request was a GET or a POST.)

sub registration_page {
  my ($session, $q) = @_;
  
  my $c = Captcha::reCAPTCHA->new;
  push @tpl_data, (
				   captcha	  => $c->get_html($conf{captcha_pubkey}),
				   pagetitle	=> 'New User Registration',
				  );

  # Bail out if we're displaying the blank form instead of processing a
  # submission
  return 'register.tpl' unless $q->param('registerbtn');

  # Check captcha
  my $result = $c->check_answer($conf{captcha_privkey}, $ENV{'REMOTE_ADDR'},
								$q->param('recaptcha_challenge_field'),
								$q->param('recaptcha_response_field'));
  unless ($result->{is_valid}) {
	push @message_loop, { errstr => get_message('captcha_failed') };
	return 'register.tpl';
  } 

  # Verify all required data present and save to database if so

  push @message_loop, { msgstr => get_message('register_ok') };
  return 'main.tpl';
}


Was This Post Helpful? 0
  • +
  • -

#7 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 26 June 2009 - 06:25 AM

View Postdsherohman, on 26 Jun, 2009 - 04:52 AM, said:

Here's the (heavily-edited to remove irrelevant sections) source to a "register" method I've used in the past. It's using HTML::Template to handle output and is set up so that the same method/URL will display the blank form when passed no data, or check the captcha and store the data if data is POSTed to it. (Conceptually REST-like, but based on whether it receives data or not rather than on whether the request was a GET or a POST.)

sub registration_page {
  my ($session, $q) = @_;
  
  my $c = Captcha::reCAPTCHA->new;
  push @tpl_data, (
				   captcha	  => $c->get_html($conf{captcha_pubkey}),
				   pagetitle	=> 'New User Registration',
				  );

  # Bail out if we're displaying the blank form instead of processing a
  # submission
  return 'register.tpl' unless $q->param('registerbtn');

  # Check captcha
  my $result = $c->check_answer($conf{captcha_privkey}, $ENV{'REMOTE_ADDR'},
								$q->param('recaptcha_challenge_field'),
								$q->param('recaptcha_response_field'));
  unless ($result->{is_valid}) {
	push @message_loop, { errstr => get_message('captcha_failed') };
	return 'register.tpl';
  } 

  # Verify all required data present and save to database if so

  push @message_loop, { msgstr => get_message('register_ok') };
  return 'main.tpl';
}





thanks dsherohman, I have requested my hosting company to install the HTML::Template module. I will give it a try.. is the 'register.tpl' and 'main.tpl' from the module. or your pages?


I see the module use a .tmpl can it also use a .tpl

This post has been edited by winracer: 26 June 2009 - 06:51 AM

Was This Post Helpful? 0
  • +
  • -

#8 dsherohman  Icon User is offline

  • Perl Parson
  • member icon

Reputation: 226
  • View blog
  • Posts: 654
  • Joined: 29-March 09

Re: integrate captcha perl script into different perl script

Posted 27 June 2009 - 05:08 AM

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

thanks dsherohman, I have requested my hosting company to install the HTML::Template module.

HTML::Template is not necessary to this in general, I just mentioned it to clarify why I'm not printing any HTML from that sub. When using HTML::Template (or any templating system), you tell it which template to render and pass in a data structure (%tpl_data in this case) which provides the information which gets plugged into the template to create an output page.

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

I will give it a try.. is the 'register.tpl' and 'main.tpl' from the module. or your pages?

They're my template files from that application. register.tpl is the registration page and main.tpl is the front (main) page.

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

I see the module use a .tmpl can it also use a .tpl

The file extension doesn't actually matter. The author just prefers .tmpl, while I'm in the habit of using .tpl for HTML::Template files.
Was This Post Helpful? 0
  • +
  • -

#9 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 29 June 2009 - 05:36 AM

View Postdsherohman, on 27 Jun, 2009 - 04:08 AM, said:

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

thanks dsherohman, I have requested my hosting company to install the HTML::Template module.

HTML::Template is not necessary to this in general, I just mentioned it to clarify why I'm not printing any HTML from that sub. When using HTML::Template (or any templating system), you tell it which template to render and pass in a data structure (%tpl_data in this case) which provides the information which gets plugged into the template to create an output page.

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

I will give it a try.. is the 'register.tpl' and 'main.tpl' from the module. or your pages?

They're my template files from that application. register.tpl is the registration page and main.tpl is the front (main) page.

View Postwinracer, on 26 Jun, 2009 - 01:25 PM, said:

I see the module use a .tmpl can it also use a .tpl

The file extension doesn't actually matter. The author just prefers .tmpl, while I'm in the habit of using .tpl for HTML::Template files.


thanks, I have been playing around with it. I have HTML::Template installed by my hosing company. I know that you have said in the past that this would be good.


again thanks for all your help. I am still reading up on it. Do you know of any other good modules that I should be looking at and have installed?
Was This Post Helpful? 0
  • +
  • -

#10 dsherohman  Icon User is offline

  • Perl Parson
  • member icon

Reputation: 226
  • View blog
  • Posts: 654
  • Joined: 29-March 09

Re: integrate captcha perl script into different perl script

Posted 30 June 2009 - 03:51 AM

View Postwinracer, on 29 Jun, 2009 - 12:36 PM, said:

Do you know of any other good modules that I should be looking at and have installed?


Depends a lot on what you're doing, of course, but there are some very prominent people in the Perl community currently developing "Modern Perl", "Enlightened Perl", and "Perl 5i" as baseline collections of modules to use in most/all cases, so those would be good places to look.

A lot of people are also very enthusiastic about Moose as a base for object-oriented programming in Perl, DBIx::Class as an object-relational database interface, and Catalyst as a framework for web applications, but, in all honesty, I don't use any of them myself. (I hope to start using Moose next month, once my current project goes into beta and I have time to learn it; I don't like DBIx::Class's model, so I'm contemplating writing my own ORM (or I might just use KiokuDB instead); and Catalyst just feels too heavy to me, but I have high hopes for Mojo/Mojolicious as a potential replacement for it.)
Was This Post Helpful? 0
  • +
  • -

#11 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 30 June 2009 - 05:27 AM

View Postdsherohman, on 30 Jun, 2009 - 02:51 AM, said:

View Postwinracer, on 29 Jun, 2009 - 12:36 PM, said:

Do you know of any other good modules that I should be looking at and have installed?


Depends a lot on what you're doing, of course, but there are some very prominent people in the Perl community currently developing "Modern Perl", "Enlightened Perl", and "Perl 5i" as baseline collections of modules to use in most/all cases, so those would be good places to look.

A lot of people are also very enthusiastic about Moose as a base for object-oriented programming in Perl, DBIx::Class as an object-relational database interface, and Catalyst as a framework for web applications, but, in all honesty, I don't use any of them myself. (I hope to start using Moose next month, once my current project goes into beta and I have time to learn it; I don't like DBIx::Class's model, so I'm contemplating writing my own ORM (or I might just use KiokuDB instead); and Catalyst just feels too heavy to me, but I have high hopes for Mojo/Mojolicious as a potential replacement for it.)



cools thanks, I will review them. I have a perl (classified ad )program/scripts that I bought about five years ago and trying to change it. I have learned alot. It might just be good idea for me to start writing one of my own. But I think it might be a lot of work.

dsherohman thanks for your comments and help
Was This Post Helpful? 0
  • +
  • -

#12 chorny_cpan  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 52
  • Joined: 13-May 09

Re: integrate captcha perl script into different perl script

Posted 30 June 2009 - 06:19 AM

Perl::Critic (as command line tool perlcritic) and perltidy are good tools to maintain code.
Was This Post Helpful? 0
  • +
  • -

#13 winracer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: integrate captcha perl script into different perl script

Posted 01 July 2009 - 06:15 AM

View Postchorny_cpan, on 30 Jun, 2009 - 05:19 AM, said:

Perl::Critic (as command line tool perlcritic) and perltidy are good tools to maintain code.



thanks I will review
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1