Forum Moderators: phranque

Message Too Old, No Replies

Stop hotlinking, how?

They steal my bandwith, how to stem them.

         

kusop

2:58 pm on May 6, 2005 (gmt 0)

10+ Year Member



Hi!

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]

MrSniffles

3:12 pm on May 6, 2005 (gmt 0)

10+ Year Member



are they really *YOUR* episodes to be leeched? i mean it sounds like you are complaining that someone else is stealing something you yourself stole.

kusop

3:23 pm on May 6, 2005 (gmt 0)

10+ Year Member



that smallville was example, to be honest I am hosting unlicensed Bleach eps. But its kinda childish so I put Smallville as example to sound mature :D

kusop

3:58 pm on May 6, 2005 (gmt 0)

10+ Year Member



btw unlicensed bleach episodes = legal to host online.

kusop

7:35 pm on May 6, 2005 (gmt 0)

10+ Year Member



jdMorgan,

should the episode1.avi be saved as /mp3/episode1.avi

or

/media/mp3/episode1.avi?

twist

4:29 am on May 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your physical file is located at,

[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]

kusop

4:28 pm on May 7, 2005 (gmt 0)

10+ Year Member



Sorry to say this, but your code twist, isnt working..
I really need help..

PatrickDeese

4:40 pm on May 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



be sure to change the ¦ to a solid pipe - the forum doesn't allow the solid pipe character, but you need it for your htaccess file to be valid.

jdMorgan

5:25 pm on May 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps a minor point:

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:

  • Tell us how you have tested it. What inputs did you provide, and what outputs were observed?
  • Tell us how it is not working -- How did your test results differ from your expectations?
  • Post the relevant contents of your server error log if you are getting a server error.
  • If you have not studied the mod_rewrite documentation [httpd.apache.org], please do so now. There is little chance of success without basic understanding.

WebmasterWorld member Twist came up with this idea and generously posted it for others to use, but he is under no 'obligation' to provide 'support' for it. As a matter of both efficiency and courtesy, I suggest you make it easy for other members to help you. A review of our forum charter [webmasterworld.com] may help to explain this.

Jim