0

I just upgraded my server and now a simple log script reaks of errors.

#!/usr/bin/perl
use CGI ':standard';
use warnings;

$database = "/full_path/filename.shtml";

$shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
open (DATABASE,">>$database");
print DATABASE "$ENV{'REMOTE_ADDR'} - $shortdate - $ENV{'SCRIPT_URI'} - $ENV{'HTTP_USER_AGENT'}<!-- - $ENV{'HTTP_REFERER'}--><BR>\n";
close(DATABASE);
{
print "Content-Type: text/html\n\n";
print <<EOM;
<PRE>
</PRE>
EOM
exit;
}

When using SSH to get the error, it spits out

Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.

like it now can't recognize the $ENV stuff. I try to upgrade it to strict...

#!/usr/bin/perl
use CGI ':standard';
use strict;
use warnings;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

my $database = "/var/www/vhosts/cmgscc.com/httpdocs/craigslist/ebaylogs.shtml";

my $REMOTE_ADDR = "$ENV{'REMOTE_ADDR'}";
my $scripturi = "$ENV{'SCRIPT_URI'}";
my $HTTP_USER_AGENT = "$ENV{'HTTP_USER_AGENT'}";
my $HTTP_REFERER = "$ENV{'HTTP_REFERER'}";


my $shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
    open (DATABASE,">>$database");
        print DATABASE "$REMOTE_ADDR - $shortdate - $scripturi - $HTTP_USER_AGENT<!-- - $HTTP_REFERER--><BR>\n";
    close(DATABASE);

{
   print "Content-Type: text/html\n\n";
print <<EOM;
<PRE>
</PRE>
EOM
   exit;
}

and it also does the same thing. Only the date goes through.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Nintendo
0

chmod'ing all folders 777, back to the domain does it. For example, two folders and a file...

httpdocs/folder/file.shtml

and it then works.

Edited by Nintendo: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.