Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 1999, 04:26 AM
tomasp
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > check referrer while downloading script attempt

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap