rakz
09-22-2006, 12:30 AM
Hey guys im having a problem when im running a cgi script
this script is used to run a query to a databse
and then produces a form
the form then can be changed and updated
and submitted to a master pogram
when we are trying to upload this form
the logs are not going to the right folder
preventing the form to be created on the server
how do we define the path that a file is to be created to
the code is as follow
definition of the path
#---------------------------------------------------------------------------
$filesdir = ''; # This needs to be the path to the location of the files
# from the root directory ex. if files are located c:\home\root\usrname\scripts\files
# then $filesdir = scripts\files
# if blank, program will use same directory as cgi directory
#---------------------------------------------------------------------------
setting the variable
my $log_file="exsubmit.log";
and
creating log file
# create log file
log_array(pairs);
the sub routine for errors is this
sub log_line($)
{
my $line = shift;
open( LOG_FILE, ">>$Lfilesdir$log_file" ) or error( "Could not open $Lfilesdir$log_file: $!", 'die', $this_script_name );
print LOG_FILE "[",scalar(localtime), "]",$ENV{REMOTE_ADDR},":",$line,"\n";
close( LOG_FILE );
}
sub log_array($)
{
my $array = shift;
my $line;
foreach ( @$array ) {
$line=$line."$_, ";
}
log_line($line);
}
please advise what i can do to fix the problem
this script is used to run a query to a databse
and then produces a form
the form then can be changed and updated
and submitted to a master pogram
when we are trying to upload this form
the logs are not going to the right folder
preventing the form to be created on the server
how do we define the path that a file is to be created to
the code is as follow
definition of the path
#---------------------------------------------------------------------------
$filesdir = ''; # This needs to be the path to the location of the files
# from the root directory ex. if files are located c:\home\root\usrname\scripts\files
# then $filesdir = scripts\files
# if blank, program will use same directory as cgi directory
#---------------------------------------------------------------------------
setting the variable
my $log_file="exsubmit.log";
and
creating log file
# create log file
log_array(pairs);
the sub routine for errors is this
sub log_line($)
{
my $line = shift;
open( LOG_FILE, ">>$Lfilesdir$log_file" ) or error( "Could not open $Lfilesdir$log_file: $!", 'die', $this_script_name );
print LOG_FILE "[",scalar(localtime), "]",$ENV{REMOTE_ADDR},":",$line,"\n";
close( LOG_FILE );
}
sub log_array($)
{
my $array = shift;
my $line;
foreach ( @$array ) {
$line=$line."$_, ";
}
log_line($line);
}
please advise what i can do to fix the problem