Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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, 05: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


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




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek