Hello all,
I posted this at another forum and managed to get 0 replies as of yet. Luckily, from what I have seen, this board seems be more hospitable towards noobies.
I have only recently started learning cgi. Thus, the following problem I am having with combining a "snippet" with a working script. We are trying to implement a "captcha" (image verification) into a forum script. The "working" script handles information from the form on the html page (new post). I have made this work with 2 other scripts, but this one has me stumped. Any help at all in pointing me in the right direction will be greatly appreciated.
My code (partial, as I am not permitted to show the entire code):
#!/usr/bin/perl
###########
#Begin Captcha
###########
use CGI;
$q = new CGI;
use Digest::MD5 qw(md5_hex);
my $skey = 'ChangeIt'; # secret key
my $code = $q->param('code'); # user put code
my $session = $q->param('hv_sess');
my $hash = $q->param('hv_hash');
my $expire = 60*2; # seconds expire session
if (time - $session > $expire ) {
print "Content-type: text/html\n\n";
print "Error: The code has expired";
exit;
}
if ($hash ne md5_hex($code,$skey,$session) ) {
print "Content-type: text/html\n\n";
print "Error: No valid code.";
exit;
}
##########
#End Captcha
##########
##########
#Begin Original script
##########
require "variables.cgi";
&get_template;
@month=("January","February","March","April","May","June","July","August","September","October","November","December");
@day=("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
etc, etc, etc,
Now, when I run the script it returns the following error in the log:
Global symbol "$name" requires explicit package name at ..........
And the same error is repeated for every form field the script gets its variables from.
I'm not sure why, but it seems to me that the captcha part is dumping the info that was passed from the form. But more than likely, it is not. I don't know.
Maybe I am not giving enough information here. Let me know. Anyway, any help you can give this 30 something lamer is greatly appreciated.
Stang
I posted this at another forum and managed to get 0 replies as of yet. Luckily, from what I have seen, this board seems be more hospitable towards noobies.
I have only recently started learning cgi. Thus, the following problem I am having with combining a "snippet" with a working script. We are trying to implement a "captcha" (image verification) into a forum script. The "working" script handles information from the form on the html page (new post). I have made this work with 2 other scripts, but this one has me stumped. Any help at all in pointing me in the right direction will be greatly appreciated.
My code (partial, as I am not permitted to show the entire code):
#!/usr/bin/perl
###########
#Begin Captcha
###########
use CGI;
$q = new CGI;
use Digest::MD5 qw(md5_hex);
my $skey = 'ChangeIt'; # secret key
my $code = $q->param('code'); # user put code
my $session = $q->param('hv_sess');
my $hash = $q->param('hv_hash');
my $expire = 60*2; # seconds expire session
if (time - $session > $expire ) {
print "Content-type: text/html\n\n";
print "Error: The code has expired";
exit;
}
if ($hash ne md5_hex($code,$skey,$session) ) {
print "Content-type: text/html\n\n";
print "Error: No valid code.";
exit;
}
##########
#End Captcha
##########
##########
#Begin Original script
##########
require "variables.cgi";
&get_template;
@month=("January","February","March","April","May","June","July","August","September","October","November","December");
@day=("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
etc, etc, etc,
Now, when I run the script it returns the following error in the log:
Global symbol "$name" requires explicit package name at ..........
And the same error is repeated for every form field the script gets its variables from.
I'm not sure why, but it seems to me that the captcha part is dumping the info that was passed from the form. But more than likely, it is not. I don't know.
Maybe I am not giving enough information here. Let me know. Anyway, any help you can give this 30 something lamer is greatly appreciated.
Stang