SVN: toys/rsget.pl/Link/SecuredIn

sparky sparky at pld-linux.org
Sat Oct 24 03:02:52 CEST 2009


Author: sparky
Date: Sat Oct 24 03:02:52 2009
New Revision: 10844

Modified:
   toys/rsget.pl/Link/SecuredIn
Log:
- better captcha handling, but no captcha processor
  (too difficult and not worth the effort)


Modified: toys/rsget.pl/Link/SecuredIn
==============================================================================
--- toys/rsget.pl/Link/SecuredIn	(original)
+++ toys/rsget.pl/Link/SecuredIn	Sat Oct 24 03:02:52 2009
@@ -39,13 +39,30 @@
 
 	GET( $img, keep_referer => 1 );
 
-	CAPTCHA( "image/jpeg" );
+	CAPTCHA( qr/[A-Z0-9]/i );
+
+	GOTO stage_checkcaptcha if defined $_;
+
+	GET( "/ajax-handler.php", post => { cmd => "captcha" }, keep_referer => 1 );
+
+	s/\s+//g;
+	warn "resp: '$_'\n";
+	$-{cap_form}->set( captcha_hash => $_ );
+
+	GOTO stage_captcha;
+
+stage_checkcaptcha:
 	$-{cap_form}->set( captcha_key => $_ );
 
 	GET( $-{cap_form}->post() );
 
 	$-{cap_form} = $self->form( id => "frm_captcha" );
-	GOTO stage_captcha if $-{cap_form};
+	if ( $-{cap_form} ) {
+		CAPTCHA_RESULT( "FAIL" );
+		GOTO stage_captcha;
+	}
+
+	CAPTCHA_RESULT( "OK" );
 
 stage_find_links:
 


More information about the pld-cvs-commit mailing list