Click to See Complete Forum and Search --> : Send variable to another file


fareen
07-10-2005, 10:35 PM
Hi all,
I've a problem which I hope anyone of you experts out there can render your expertise to help me provide a solution. I'm a newbie....so pls excuse my ignorance.

How would i take a variable from one file and send it to another file. Basicaly all i want to do is get the user code send to uploader.cgi which is inputed through main.pl file.

Below is part of the main.pl

#!/usr/bin/perl
push(@INC, '.');
use CGI qw(:standard);
$cgi = CGI->new;
$this = "https://www.mysite.com/cgi-bin/main.pl";
$fpath = "https://www.mysite.com";
$hpath = "/var/www/members/reports";
$filepaths = "/var/www/members/reports/todo";
$passfile = "pswd/pass.log.pl";

$fnames[0] = "query1";
$fnames[1] = "query2";

$fdesc[0] = "List";
$fdesc[1] = "Reports";

if (param()) {
if (param('cmd') eq "auth") {
&authenticate;
&load_type_list;
} elsif (param('fname')) {
$incookie = $cgi->cookie('buscode');
if ($incookie eq "") {
&load_login;
} else {
&do_load_links;
}
} elsif (param('getfile')) {
$incookie = $cgi->cookie('buscode');
if ($incookie eq "") {
&load_login;
} else {
&get_file;
}
}
} else {
&load_login;
}

Now this variable 'buscode' is to be send to uploader.cgi

'Part of uploader.cgi'

#!/usr/bin/perl
require 'cgi-lib2.pl';
$parent_dir = "/var/www/lamp/reports/upload/";

This is were $parent_dir = "/var/www/lamp/reports/upload/$buscode"; will be send.

I'm at wits end and sure appreciate some helps from gurus out there.
Thanks

Jeff Mott
07-11-2005, 01:49 AM
Why are the things you need to do in separate programs? There isn't much of a nice solution the way it is setup right now. You'd be better of rethinking the structure of the whole program.

Also, check out the sticky thread "Learn Perl and CGI..." for other useful info.

fareen
07-15-2005, 11:27 PM
Hi Jeff,

be better of rethinking the structure of the whole program.



Are you willing to take a chance?