Forum Moderators: phranque

Message Too Old, No Replies

block hotlinking in embed code?

         

cdog863

6:52 am on Sep 19, 2006 (gmt 0)

10+ Year Member



Hi,

This is my problem. On my site I have a php file that redirects to a
.asx file to play videos on my site.

so it would work in this process...

1.) embed src =mysite.com/asxgen.php
2.) asxgen.php redirects to a asx file generated by asxgen.php
3.) embed plays the generated .asx file

other sites are being able to use my videos by doing the following...

1.) embed src = theirsite.com/theirasxfile.asx
2.) the entry in their asx file contains
<REF SRC=http://www.mysite.com/asxgen.php>
3.) Their embed plays MY .asx file.

I want to allow users to post my videos on their personal pages, but I
do not want this one certain site to beable to use it

any ideas on how i can block access from just one certain site?

Thank you in advance

jdMorgan

2:04 pm on Sep 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This thread [webmasterworld.com] (and many others) addresses the issue of blocking one particular referrer.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

[edited by: jdMorgan at 2:04 pm (utc) on Sep. 19, 2006]

cdog863

6:20 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



This is my code...

RewriteEngine on

#RewriteRule ^mem/(.*).html vidpage_mem.php?clink=$1
RewriteRule ^funny/(.*).html findfunny.php?kterm=$1
RewriteRule ^videocodefun/(.*).html funvidpage.php?clink=$1
RewriteRule ^videocode/(.*).html vidpage.php?clink=$1
RewriteRule ^buzz/(.*).html buzz.php?daurl=$1
RewriteRule ^lyrics/(.*)_lyrics_-(.*).html lyrics.php?xmp=$2
RewriteRule ^top100.html top100.php
RewriteRule ^recent100.html recent100.php
RewriteRule ^(.*)_music.html findit.php?type=2&source=1&iss=1&kterm=$1
RewriteRule ^music/index.html music.php
RewriteRule ^music/(.*)--(.*).html musicpage.php?clink=$2

RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.com [NC]
RewriteCond %{REQUEST_URI} /dovid.php?vid=(.*)&med=go.asx
RewriteRule .* [mysite.com...] [R=301,L]

any ideas on why it wouldn't be working?

jdMorgan

11:02 pm on Sep 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because REQUEST_URI will contain only the URI, and not the query string attached to it.

So a better way to code would be:


RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.com [NC]
RewriteCond %{QUERY_STRING} ^vid=[^&]+&med=go\.asx
RewriteRule ^dovid\.php$ http://www.example.com/dovid.php?sid=noway [R=301,L]

Jim

[edited by: jdMorgan at 11:03 pm (utc) on Sep. 19, 2006]

cdog863

11:24 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



hmmmm for some reason it's still not working, maybe because the code is in an < embed > tag and can't get a referrer?