ok. this is going to be a kind of long post. what i have right now is a webpage with many large videos that i do not want anyone to link from any other page. currently i have on the videos.htm links to script.pl?video=000 .. and it is logging a bunch of stuff and in no way getting in the way of the download. i don't know of a way that right clicking gives off a referrer. this is the current script:
***


#!/usr/local/bin/perl

#HTTP_USER_AGENT

#capture and separate all info passed to the script
$buffer = $ENV{'QUERY_STRING'};

@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$VAL{$name} = $value;
}

open (VIDEOFILE, "video.dat");
while (<VIDEOFILE> )
{
@line = split(/:::/, $_);

#if anyone is reading this, this is cheesy code. the condition should be in
#the while, it just wasnt' working for some reason. oh well. here it is
if ($line[0] eq $VAL{video})
{
$filepath = $line[1];
}
}
close (VIDEOFILE);

if ($ENV{HTTP_REFERER} eq "")
{
$ENV{HTTP_REFERER} = "RIGHT_CLICK";
}

open (LOGFILE, ">>log_videodl.log");
print LOGFILE $VAL{video};
print LOGFILE "---";
print LOGFILE $ENV{HTTP_REFERER};
print LOGFILE "---";
print LOGFILE $ENV{REMOTE_ADDR};
print LOGFILE "---";
print LOGFILE $ENV{REMOTE_HOST};
print LOGFILE "---";
print LOGFILE $ENV{HTTP_USER_AGENT};
print LOGFILE "n";

close (LOGFILE);

print "Content-type: text/htmln";
print "Location: $filepathnn";

***
this currently isn't really doing much except i catch the occasional site linking when people left click.

my goal of the script is. 1. to not interfere in any way 2. to check referrer ( if videos.htm or NO referer (because people use getright and programs like that to resume) then to download the video BUT if there is a referrer and it is not videos.htm to direct them to the main page 3. to log unsuccessful video downloads


ANY and ALL help or suggestions on what could be done better if not totally possible would be very much appreciated.
thank you,
tomas p