|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Cgi Scripting problem
Help if anyone can point me in the right direction?
Im trying to run a cgi script and Im getting errors. The script seems to be right but errors out: Code:
#!/usr/bin/perl -w
package path_ref;
require 5.002;
sub new {
my $self = {};
bless $self;
return $self;
}
sub gopath {
my ($self) = @_;
my @ff;
my $mainServer = $ENV{'SERVER_ADMIN'};
$mainServer =~ s/root@/http:///o;
my $server = "http://$ENV{'HTTP_HOST'}";
my $ref = " / / / / / / ";
if ($ENV{'HTTP_REFERER'}) {
$ref = $ENV{'HTTP_REFERER'};
}
if ($ENV{'SCRIPT_FILENAME'} =~ /printenv.cgi/) { # do this for the INCLUDED shtml
$ref = "$server$ENV{'DOCUMENT_URI'}";
}
@ff = split///, $ref;
my $fil = pop(@ff);
if (($ref =~ /$server/)||($ENV{'REQUEST_METHOD'} eq "PUT")){ # the form and cgi have same domain
if ($mainServer eq $server) { # no new domain
@path = ($mainServer,"$ff[4]/$ff[5]", $server, $fil);
} else { # new domain
@ff = split///, $ENV{'DOCUMENT_ROOT'};
@path = ($mainServer, "$ff[5]/$ff[6]", $server, $fil);
}
} else { # the form and cgi don't have same domain hacker
@path = ("error");
}
return @path;
}
1;
The error I get is: Code:
[root@site modP]# perl printenv.cgi Use of uninitialized value in substitution (s///) at path_ref.pm line 14. Use of uninitialized value in concatenation (.) or string at path_ref.pm line 15. Use of uninitialized value in pattern match (m//) at path_ref.pm line 20. Use of uninitialized value in string eq at path_ref.pm line 25. Content-type: text/html Any help at all will be appreciated. -Lady Cherry |
|
#2
|
|||
|
|||
|
RE: Cgi Scripting problem
i'm not sure of how to fix the problem but this site is mainly based for PHP and also the forum area you posted in is for questions based on how to setup, maintain and work with servers. not server scripts. i sugguest you go back to the forum and re-ask your question in the coding section. someone who knows CGI well may answer your question but otherwise like said before this site is mainly based off PHP
|
|
#3
|
|||
|
|||
|
RE: Cgi Scripting problem
I believe that when you run it from the command line it doesn't have HTTP_HOST defined (as that *should* come from the web browser or what not). Runnint it as a web page might help!
Good luck! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Cgi Scripting problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|