Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining 2 scripts - Lamer needs help.

Status
Not open for further replies.

IamStang

Technical User
Feb 12, 2005
27
US
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
 
Where is the variable $name at?

The script returning the error must be using strict, and the variable $name is not marked (packaged) with my:

my $name = ....
 
Thanks for taking th time to have a look at this. I know there isnt a great deal of info there to work with, but, as I said, I am not permitted to show more of it.

I will take a look into where the variables are called. It would seem as though "variables.cgi" might be the culpret. Not sure yet.

Thanks for your input though. It might very well have pointed me in the right direction with this problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top