View Single Post
Old 2009-07-12, 12:42 PM   #53
badmuffy
Internet! Is that thing still around?
 
Join Date: Jul 2009
Posts: 1
Quote:
Originally Posted by stev0 View Post
This is what I use and it works with my wmv files...

.htaccess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*yourdomain.com(:80)*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*anyotherreferingdomain.com(:80)*/ [NC]
RewriteCond %{HTTP_COOKIE} !(^|(.+*)id=valid(;.*|$)
RewriteRule /* http://www.picz.ca/notice.html [R,L] )


Then here's the trick to get it working with wmv's or any file for that matter.

Put this in the head of the html file that your visitors will see (with the videos on it).

<SCRIPT LANGUAGE="javascript">
// Calculate the expiration date
var expires = new Date ();
expires.setTime(expires.getTime() + 24 * 60 * 60 * 1000);
document.cookie = "id=valid; path=/" + "; expires=" + expires.toGMTString();
</SCRIPT>


That javascript will make a cookie (which is one of the rewritecond's in the htaccess file). So even though the wmv file doesnt show a referal, the surfer that was at that page will have that cookie and therfore can download the wmv file.

I saw this thread and am trying to implement this system of using a cookie to protect my mgp galleries, along with the .htaccess code. But it doesn't seem to be working. Has anyone used this successfully for mgp's and if so is it still worth trying this I thought tgp owners don't allow cookies anymore? (If you can't already tell I am a noob) : D
badmuffy is offline   Reply With Quote