CGI script log file

They have: 6 posts

Joined: Feb 2000

A CGI sendmail script I recently installed is supposed to maintain a log, but isn't. The problem persists even when I create a blank log file under the name specified in the script. The script is running on a Windows NT web server, and works just fine otherwise. Any guesses as to what's wrong?

They have: 122 posts

Joined: Jun 2000

Mind posting a snippet of code to look at?

They have: 6 posts

Joined: Feb 2000

Here's some of the code:

$LOGFILE="http://friendscb.org/_private/reflog.txt";

if ($SENDMAIL ne "")
{&test_sendmail;}

&valid_page; #if script is called from offsite, bounce it!
&decode_vars;
if ( $ENV{'REQUEST_METHOD'} ne "POST")
{
&draw_request;
exit;
}
&do_log;
&process_mail;
print "Location: $JUMP_TO\n\n";

[...]

sub do_log
{
open (ZL,">>$LOGFILE");
$date=localtime(time);
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}
$logline="$date\|$JUMP_TO\|$fields{'send_email'}\|$fields{$recipemail}\|\n";
print ZL $logline;
}
close(ZL);

They have: 122 posts

Joined: Jun 2000

You cannot write to a http:// address unless it's a folder or using a socket connection. try changing $LOGFILE to /home/wherever/_private/reflog.txt or whatever the file name is.

Rob Radez
OSInvestor.com

They have: 1,587 posts

Joined: Mar 1999

yeap, u need to use the path to the file, not url.

------------------
Thumbs up or downs ratings and more on affiliate programs.CLICK 4 CASH

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.