Welcome, Guest. Please Login or Register
  YaBB is sponsored by XIMinc!
  HomeHelpSearchLogin Forgot Password Register  
 
Page Index Toggle Pages: 1
Send Topic Print
Captcha Misconfig? (Read 1069 times)
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #12 - Dec 8th, 2009 at 8:11am
 
did you get it working?
Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #11 - Dec 7th, 2009 at 7:08pm
 
Windows CAPTCHA Fix - I was clear in the description that I knew nothing about windows and did not know if it would work on that o/s. Apparently, it does work, but according to Jeff, you need a binmode statement added to the captcha.cgi to keep the image from being distorted. Here is what he says:

I came across your captcha.cgi PERL script and noticed that on Windows it generated a garbled verification image sometimes when the form loads. If you add:

binmode STDOUT;

to the captcha.cgi script directly above where you print out the headers

Code:

(print "Content-type: image/jpeg\n";) it solves this problem.

Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #10 - Dec 7th, 2009 at 7:07pm
 
Confused Kitty wrote on Dec 7th, 2009 at 4:38pm:
Before I go any further.  The script you just sent mentions UNIX all over the place.  The site I'm trying to use this Captcha on is Windows platform.  Does that have any significance?


yes it will work on windows

below is from
Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login or Register


Code:

CAPTCHA for PERL Uer Notes and Fixes

Thousands of perl developers have downloaded the captcha for perl program and added it to their current programs. Here are a few useful ideas from some webmasters that may be handy in your application of the script.

Windows CAPTCHA Fix - I was clear in the description that I knew nothing about windows and did not know if it would work on that o/s. Apparently, it does work, but according to Jeff, you need a binmode statement added to the captcha.cgi to keep the image from being distorted. Here is what he says:

I came across your captcha.cgi PERL script and noticed that on Windows it generated a garbled verification image sometimes when the form loads. If you add:

binmode STDOUT;

to the captcha.cgi script directly above where you print out the headers
(print "Content-type: image/jpeg\n";) it solves this problem.


--------------------------------------------------------------------------------

Image Reload Problems - Many people have had issues with users backing up and trying to submit the form after a captcha failure, since the old image is cached and there is no file to verify against since there was already a failure, it fails again and again. People don't know what reload or refresh means, so you almost have to do it for them.

Knut from Norway found the answer with a simple java script link to reload the image automatically. Here is what he offers:

<script language="javaScript">

function reloadCAPTCHA() {

document.getElementById('CAPTCHA').src='captcha.cgi?randomnumber?'+Date();

}

</script>

<a href="javascript:reloadCAPTCHA();">Load New Code</a>




Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Re: Captcha Misconfig?
Reply #9 - Dec 7th, 2009 at 6:55pm
 
absolute path doesn't make a difference either.  what is wrong?  my perl form handler works just fine.

Back to top
« Last Edit: Dec 8th, 2009 at 8:11am by Help Me With Perl »  
 
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Re: Captcha Misconfig?
Reply #8 - Dec 7th, 2009 at 4:38pm
 
Before I go any further.  The script you just sent mentions UNIX all over the place.  The site I'm trying to use this Captcha on is Windows platform.  Does that have any significance?
Back to top
 
 
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Re: Captcha Misconfig?
Reply #7 - Dec 7th, 2009 at 4:29pm
 
Would the absolute path include my domain? 


yes also here is a script that should tell you just copy to file name it pathtest.pl and call it from you Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login or Register

Code:


#!/usr/bin/perl


### *** IMPORTANT FOR UNIX *** ###

### *** Make sure the path to PERL above is correct *** ###

#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#
#
# Program is copyright by Ranson's Scripts all rights reserved
# Email - support@rlaj.com
#
# Program Name ------- pathtest.pl
# Program Version ---- 2.0
# Configuration File - none
#
#
#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#


print "Content-type: text/html\n\n";

$Perl_Version = "Perl Version $]";

if (-d "C:/" || $^O eq "MSWin32") {
$windows = 1;
$platform = "WINDOWS";

} elsif (-e "/etc") {
$unix = 1;
$platform = "UNIX";

} else {
$unix = 1;
$platform = "UNKNOWN PLATFORM";
}

foreach $key (keys(%ENV)) {
if ($key =~ /cookie/i) { $key = "" }
$My_Key .= "<TR><TD>$key<TD> $ENV{$key}</TD></TR>\n";
if ($ENV{$key} =~ /\w:\\.+\\pathtest.pl/ && $windows eq "1") { $path = "$ENV{$key}"; }
}
if ($0 =~ /pathtest.pl/) { $path = "$0"; }
elsif ($ENV{'SCRIPT_FILENAME'}) { $path = "$ENV{'SCRIPT_FILENAME'}"; }
if ($ENV{'DOCUMENT_ROOT'} ne "") { $document_root = "<B>Document Root:</B> <FONT COLOR=FF0000>$ENV{'DOCUMENT_ROOT'}</FONT>"; }

$path =~ s/pathtest\.pl//;
$path =~ s/\\$//;
$path =~ s/\/$//;


if ($platform eq "UNIX") {
$Sendmail = `whereis sendmail`;
}

@Sendmail = split(/\s+/, $Sendmail);

foreach $place(@Sendmail) {
if($place !~ /\./) {
push(@SendMail, "$place \&nbsp\; ");
}
}

if ($platform eq "UNIX") {
$Path_to_Sendmail = "<B>sendmail</B> = <FONT COLOR=F04E00 FACE=arial>@SendMail</FONT><P>";
}


### *** :) *** ###



print <<"EOT";

<HTML>
<HEAD>
<TITLE>Path Test by RLAJ.COM</TITLE>
</HEAD>
<BODY BGCOLOR=FFFFFF TEXT=000000>
<TABLE BORDER=0 BGCOLOR="#FFFFFF" CELLPADDING=2 CELLSPACING=0 Width=100%>
<TR>
<TD><B><FONT FACE="Arial" COLOR="000080" SIZE="+3">&nbsp; &nbsp; Path and Environment Test</FONT></B></TD>
<TD Align=right><FONT SIZE="+1"><A HREF="http://www.rlaj.com">Ranson's Scripts</A></FONT><BR><A HREF="mailto:Support\@rlaj.com">Support\@rlaj.com</A></TD>
</TR>
</TABLE>
<P>
<TABLE BORDER=0 BGCOLOR="000080" CELLPADDING=20 CELLSPACING=0>
<TR><TD>
<CENTER>
<TABLE BORDER=0 BGCOLOR="#FFFFFF" CELLPADDING=9 CELLSPACING=0>
<TR><TD>
<BR>
<B>The operating system is:</B> <FONT COLOR=#F04E00 FACE="arial">$platform</FONT> &nbsp; $Perl_Version
<P>
<B>The path for this file is:</B> <FONT COLOR=#F04E00 FACE="arial">$path</FONT>
<P>
$document_root
<P>
$Path_to_Sendmail
</TD></TR>
</TABLE>
</CENTER>
</TD></TR>
</TABLE>
<BR><BR><BR>
<B><FONT FACE="Arial" COLOR="000080" SIZE="+1">Environment Variables</FONT></B>
<BR><BR>
<TABLE BORDER=0 BGCOLOR="#FFFFFF" CELLPADDING=2 CELLSPACING=0 Width=100%>
$My_Key
</TABLE>

EOT

print "<BR><BR><BR><BR></body></html>";


exit;

### *** *** ###


Back to top
 
 
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #6 - Dec 7th, 2009 at 4:22pm
 
Confused Kitty wrote on Dec 7th, 2009 at 4:21pm:
Made changes as you instructed (also changed check-captcha the same way).  Still no image.  No visible change.


try the the absoluite path to your script..example
only

$tempdir="/home/cgi-bin/captcha/temp"
$imagedir="/home/cgi-bin/captcha/images


do you know your  absoluite path ?
Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Re: Captcha Misconfig?
Reply #5 - Dec 7th, 2009 at 4:21pm
 
Made changes as you instructed (also changed check-captcha the same way).  Still no image.  No visible change.

Back to top
 
 
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #4 - Dec 7th, 2009 at 4:17pm
 
Help Me With Perl wrote on Dec 7th, 2009 at 4:10pm:
change

Code:


$tempdir = "/cgi-bin/captcha/temp";
$imagedir = "/cgi-bin/captcha/images";




to

Code:

$tempdir = "temp";
$imagedir = "images";



and see if works




Did this help? if not try the the absoluite path to your script..example
only

$tempdir="/home/cgi-bin/captcha/temp"
$imagedir="/home/cgi-bin/captcha/images
Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #3 - Dec 7th, 2009 at 4:10pm
 
change

Code:


$tempdir = "/cgi-bin/captcha/temp";
$imagedir = "/cgi-bin/captcha/images";




to

Code:

$tempdir = "temp";
$imagedir = "images";



and see if works
Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Re: Captcha Misconfig?
Reply #2 - Dec 7th, 2009 at 4:07pm
 
Below is the captcha.cgi file.  The only changes were made to the directory locations as instructed.

#!/usr/bin/perl
##############################################################################
# By BumbleBeeWare.com 2006
# Simple CAPTCHA using static premade images
# captcha.cgi
##############################################################################

# configuration

$tempdir = "/cgi-bin/captcha/temp";
$imagedir = "/cgi-bin/captcha/images";

##########################


# open image dir choose a random image
opendir IMGDIR, "$imagedir";
@allimgfiles = readdir IMGDIR;
     
#$totalimages = @allimgfiles;

# define each image
foreach $imgfile(@allimgfiles) {
     
     # count and use only the gif images
     if ($imgfile =~ /\.gif/i){
     $countimages++;
     $IMAGE{$countimages} = $imgfile;}
     }

# choose a random image      
$randomnumber = int rand ($countimages);
if ($randomnumber < 1){$randomnumber = 1;}

$randomimage = $IMAGE{$randomnumber};

# images are named the same as the random text
# remove the filetype extension so we have the text only
$imagetext = $randomimage;
$imagetext =~ s/\.gif//g; # remove .gif extension

# set to lower case for case insensitivity
$imagetext = lc($imagetext);

# get ip and create an id file with the text on the image
open (TMPDATA, ">$tempdir/$ENV{'REMOTE_ADDR'}");
print TMPDATA "$imagetext";
close TMPDATA;
chmod 0777, "$tempdir/$ENV{'REMOTE_ADDR'}";

# set date for cookie
$date = (time + 86400);
$expirecookie = gmtime($date);

# set a cookie with ip for any proxy servers used for image caching
print "set-cookie: checkme=$ENV{'REMOTE_ADDR'}; expires=$expirecookie\n";

# print the image to the page
print "Content-type: image/jpg\n";
print "\n";

open(IMAGE, "<$imagedir/$randomimage");
while (<IMAGE>)
{
        print $_;
}
close(IMAGE);
Back to top
 
 
IP Logged
 
Help Me With Perl
YaBB Administrator
*****
Offline


I love Perl and YaBB!

Posts: 157
The Land of Perl / YaBB
Re: Captcha Misconfig?
Reply #1 - Dec 7th, 2009 at 3:59pm
 
can you post or send me a PM with the url of your test site. also can you post some code here so that I can review it.
Back to top
 

helpmewithperl Administrator.
WWW  
IP Logged
 
Confused Kitty
YaBB Newbies
*
Offline


I Love Perl and YaBB!

Posts: 6
Captcha Misconfig?
Dec 7th, 2009 at 3:56pm
 
I have followed the instructions on Bumblebeeware.com to a T.  I can not get it to work at all.  Images will not come up even on the form.cgi.  Any suggestions?
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print