logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Hotlinking Protection for Video Files??
Author
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Wed 02 Aug '06 2:47    Post subject: Hotlinking Protection for Video Files?? Reply with quote

Hi,

I've saw numerous articles, and modules for apache that helps protect websites from hotlinking protection, but none of them work for windows. Can anyone tell me any modules, or programs that would help prevent hotlinking protection for video files.

I'm interested in something that changes the link transparently, and would work for apache on windows. Thanks
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 692

PostPosted: Wed 02 Aug '06 10:30    Post subject: Reply with quote

Please tell what you tried. When it works on *nix it should work on windows.
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Wed 02 Aug '06 10:34    Post subject: Reply with quote

admin wrote:
Please tell what you tried. When it works on *nix it should work on windows.


http://www.modhotlink.com/
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Wed 02 Aug '06 10:55    Post subject: Reply with quote

That is a binary for Linux.

I see no source on that site for 2.2, so we cannot try to build it for Windows.

Best to contact the author.


Steffen
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Wed 02 Aug '06 11:18    Post subject: Reply with quote

Well can you recommend something for windows?? I need to prevent my video files from being hotlinked. Is there any software on the market that works for apache on windows?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 02 Aug '06 12:11    Post subject: Reply with quote

I would programm in php a redirect link or a capture picture for myself.
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Wed 02 Aug '06 12:17    Post subject: Reply with quote

How do I do this??
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 02 Aug '06 13:08    Post subject: Reply with quote

this is a snippet not a final code!!!

yourpage.php
Code:

session_name('anti_hotdownload');
session_start();

if($_POST['do']==1&&$_SESSION['image'] == $_POST['code']){
                                echo '<a href="yourlink'>download</a>';

      }
      else
      {
         echo <<<END
         <form action="yourpage.php" method="post">
         <input type="hidden" name="do" value="1" />
         <input type="text" name="code" /><img src="img.php" border="0" height="20" width="60" /><br />
         <input type="submit" value="{$_lang['ok']}" />
         </form>
END;
      }


img.php
Code:

<?php
/**
* @author: James Blond, James Blond
*
* @param String $strSessionVar
* @param Array $rgBgColor
* @param Array $rgTextColor
* @param int $x
* @param int $y
* @return Image
*/
function security($strSessionVar,$rgBgColor,$rgTextColor,$x,$y){
     
mt_srand((double)microtime()*1000000); //Zufallszahl
$iRandVal = mt_rand(100000,999999);
$_SESSION[$strSessionVar] = $iRandVal;
$im = imagecreate($x,$y) or die("GD-stream konnte nicht gestartet werden");
$background_color = imagecolorallocate($im, $rgBgColor[0],
                                                $rgBgColor[1],
                                                $rgBgColor[2]);

$text_color = imagecolorallocate($im,  $rgTextColor[0],
                                           $rgTextColor[1],
                                           $rgTextColor[2]);

     
imagestring($im,5,0,0,$iRandVal,$text_color);
     
header("Content-type: image/png");
imagepng($im);
imagedestroy($im); }
session_name('anti_hotdownload');
session_start();
security('image',array(255,255,0),array(0,0,0),60,20);
 ?>

i hope you know a bit of PHP....
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Thu 03 Aug '06 11:50    Post subject: Reply with quote

Unfortunately I do not know PHP. I have a site that runs on PHP-NUKE, and I know how to go in and make small changes... but I dont know how to implement the above file. Can you please help me... people are stealing the movies directly off of my server and hotlinking them.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Thu 03 Aug '06 12:44    Post subject: Reply with quote

unmgroup wrote:
Unfortunately I do not know PHP. I have a site that runs on PHP-NUKE, and I know how to go in and make small changes... but I dont know how to implement the above file. Can you please help me... people are stealing the movies directly off of my server and hotlinking them.


To be fullproof is the best to let download only logged-in users or use a script like that one from james.

On the server side only you can do, is using mod_rewrite, see http://www.apachelounge.com/viewtopic.php?t=19

Steffen
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Thu 03 Aug '06 23:21    Post subject: Reply with quote

Yes, I have something like this in place for images. I need a solution for video protection.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Thu 03 Aug '06 23:32    Post subject: Reply with quote

And when you change in the rewrite rule the extensions gif|jpg|png to your video file extension(s) ?

Steffen
Back to top
unmgroup



Joined: 22 Jul 2006
Posts: 19

PostPosted: Fri 04 Aug '06 1:54    Post subject: Reply with quote

Steffen wrote:
And when you change in the rewrite rule the extensions gif|jpg|png to your video file extension(s) ?

Steffen


That doesnt work for video files, because the referer information is not sent.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 27 Dec '06 13:18    Post subject: Reply with quote

Code:

RewriteEngine on
 RewriteCond %{HTTP_REFERER} !^http://yourdomain.com.*$ [NC]
 RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com.*$ [NC]
 RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.yourdomain.com/stophotlinking.html [R,NC]
Back to top


Reply to topic   Topic: Hotlinking Protection for Video Files?? View previous topic :: View next topic
Post new topic   Forum Index -> Apache