#!/nyet/bin/perl #--------------------------------------------------------------------------- # (c) Copyright 1998, NetLine Corporation, All rights reserved. #--------------------------------------------------------------------------- # COPYRIGHT 1998 NetLine Corporation This program is protected as an # unpublished work under the Copyright Act of 1976 and the Computer # Software Act of 1980. #--------------------------------------------------------------------------- use strict; use CGI; #--------------------------------------------------------------------------- my $q = new CGI; my $ms = $q->param('m'); # Message-ID my $pc = $q->param('pc'); # Pub-code #my $pc = 'NLN'; if($pc eq '' || $ms eq '') { print $q->header(); print << "EOP";
ERROR: Invalid parameters passed to program
EOP
exit;
}
#---------------------------------------------------------------------------
# LOG THIS STUFF
#---------------------------------------------------------------------------
my $exclusive_lock = 2;
my $unlock = 8;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
if($year > 98){$year += 1900;}else{$year += 2000;}
my $date=sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year,$mon,$mday,$hour,$min,$sec);
#######CHANGE THIS TEXT FILE##########
if(open(LOUT, '>>' . "/home/indy/logs/webbugNLN.txt"))
{
flock(LOUT, $exclusive_lock);
printf LOUT ("$pc\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", time, $date, $pc, $ms,
$ENV{'REMOTE_ADDR'}, $ENV{'REMOTE_USER'}, $q->raw_cookie());
flock(LOUT, $unlock);
close(LOUT);
}
#---------------------------------------------------------------------------
# Serve up the image
#---------------------------------------------------------------------------
my %imageStrs = ();
my $ban = '/home/web/netline.com/oak/root/nln/clear.gif';
printImage($q, 'gif', $ban, '','');
exit;
sub printImage
{
# $type = gif or jpeg
# $file = path to image file
my ($q, $type, $file, $exp, $cookies) = @_;
if($type ne 'jpeg' && $type ne 'gif')
{
exit;
}
my($contentLength) = (stat($file))[7];
$| = 1;
if($exp eq ''){$exp = '+1m'};
my $cl = "Content-length: $contentLength";
print $q->header(-type=>'image/' . $type,
-cookie=>$cookies,
# -expires=>$exp,
$cl);
my $imStr = $imageStrs{$file};
if(! defined $imStr || $imStr eq '')
{
if(!(open(IMG, "<" . $file)))
{
exit;
}
while()
{
$imStr .= $_;
print;
}
close(IMG);
$imageStrs{$file} = $imStr;
}else
{
print $imStr;
}
}