Forum Moderators: phranque
This is my first post on the board. It looks like a good play to be. I'll get straight to my question.
People are "leeching" my episodes from my site.
The episodes are in .avi format and each of them is arround 170 MegaBytes.
I have tried the usual htaccess method by looking at HTTP referrer but people are smart enough to bypass that. They put up a link on their website (www.example.com/episode1.avi) and tell users to "right click and save target as".
There is a thread about making 3 hour valid links without HTTP referrals. --->
[webmasterworld.com...]
But I dont understand it.
this is my .htaccess file so far:
RewriteCond %{TIME_HOUR}{TIME_WDAY}$1 ^$0[012](06¦10¦21¦32¦43¦54¦65)$ [OR]
RewriteCond %{TIME_WDAY}$1 ^$00¦11¦22¦33¦44¦55¦66$
RewriteCond %{TIME_HOUR}$2 ^00(2[23]¦00)¦01(23¦0[01])¦020[012]¦030[123]¦040[234]¦050[345]¦060[456]¦070[567]$ [OR]
RewriteCond %{TIME_HOUR}$2 ^080[678]¦090[789]¦10(0[89]¦10)¦11(09¦1[01])¦121[012]¦131[123]¦141[234]¦151[345]$ [OR]
RewriteCond %{TIME_HOUR}$2 ^161[456]¦171[567]¦181[678]¦191[789]¦20(1[89]¦20)¦21(19¦2[01])¦222[012]¦232[123]$
RewriteRule ^media/([0-6])/([012][0-9])/(avi¦mpg¦mpeg)/(.+)$ /$4\.$3 [L]
and my main page where the links to episodes:
<?php$hod = date( 'H' );
if( $hod == 00 ) { $hod_prev = 23; }
else { $hod_prev = sprintf( "%02d", ( $hod - 1 ) ); }
if( $hod == 23 ) { $hod_next = '00'; }
else { $hod_next = sprintf( "%02d", ( $hod + 1 ) ); }
$link = 'media/' . $hod.chr(rand(97,122)) . $hod_prev . chr(rand(97,122)) . $hod_next . '/';
echo '<a href="' .$link. 'mp3/episode1.avi">Smallville ep 1</a>';
?>
[edited by: jdMorgan at 6:31 pm (utc) on May 6, 2005]
[edit reason] Examplified. [/edit]
[example.com...]
<?
$link = 'http://example.com/'. date( 'w' ) .'/'. date( 'H' ) .'/filename/avi';
?># htaccess
RewriteCond $1%{TIME_WDAY}%{TIME_HOUR} ^00..¦11..¦22..¦33..¦44..¦55..¦66..¦010[01]¦120[01]¦230[01]¦340[01]¦450[01]¦560[01]¦600[01]$
RewriteCond %{TIME_HOUR}$2 ^00(2[23]¦0[01])¦01(23¦0[012])¦020[0123]¦030[1234]¦040[2345]¦050[3456]¦060[4567]¦070[5678]¦
080[6789]¦09(0[789]¦10)¦10(0[89]¦1[01])¦11(09¦1[012])¦121[0123]¦131[1234]¦141[2345]¦151[3456]¦
161[4567]¦171[5678]¦181[6789]¦19(1[789]¦20)¦20(1[89]¦2[01])¦21(19¦2[012])¦222[0123]¦23(2[123]¦00)$
RewriteRule ^([0-6])/([012][0-9])/(.+)/(.+)$ /media/$3\.$4 [L]
The last thing to do is to block direct access to the original file location which jdmorgan showed me how to do but I am not sure if it will work for blocking avi files also so you should ask him.
I changed it around a little so if I made any mistakes I apologize.
[edited by: jdMorgan at 5:26 pm (utc) on May 7, 2005]
[edit reason] Fixed side-scroll. [/edit]
Sorry to say this, but your code twist, isnt working.
This is now your code. If you wish to use it, you are responsible for understanding it and getting it to work.
I really need help.
First, please help yourself:
Members seeking 'support' should follow these steps:
Jim