User talk:Mrsdonovan

Dhflashplayer website address within php?
Hi. The problem I am having is websites are stealing my video content which is eating up my bandwidth. I only use videos from one url so is it possible to add a static url to the php code instead of having it openly visible on my wiki?

I tried adding it myself but I haven't a clue about php (or coding in general) so you can probably guess that this didn't work out very well.

Also the url changes depending on the month and year e.g yadayada.com/2008/12/blah.flv - yadayada.com/2009/01/blah2.flv I think this is done with parameters but I am pretty clueless.

Help will be VERY much appreciated.

Thank You.

Mrsdonovan 18:06, 16 February 2010 (UTC) replied: Most hosts provide "Hot Link" protection which will stop external sites from accessing the content directly. Using htaccess is one method. As for customization, I can either do it at contract rates or you can fork the code yourself. Cheers.


 * There is a site that has a special path (path=$site/2009/08/) coding:
 * file=jun-ki-lee-j-style.flv|width=480|height=360|path=$site/2009/08/


 * I tried Hot Linking but it doesn't work. How can I use htaccess? I would do it for contract rates, meaning I would pay you, but how for how much?


 * http://lmgtfy.com/?q=htaccess+hotlink+protection, the top two hits should help... Mrsdonovan 16:56, 3 March 2010 (UTC)
 * But I am dealing with videos, not images. I've tried that method a hundred times and it doesn't work.
 * For example this is special path thats similar to mine above:
 * BEFORE - file=jun-ki-lee-j-style.flv|width=480|height=360|path=asianmediawiki.com/media/video/flv/ (Go to asianmediawiki and look for Lee Jun-Ki)
 * AFTER - file=jun-ki-lee-j-style.flv|width=480|height=360|path=$site/2009/08/
 * I have tried these methods but my videos don't play. Do you understand me now, I am trying to link the videos to my wiki without the path link having to be visible to visitors.


 * --> Even if I hardcoded your video file URLs in the extension, when the actual HTML code gets generated by the mediawiki php code, the path will still be visible, as it must be, because the flash player has to know where to find the file to load.  Hot link protection will work with flv files, but the problem is that if the bandwidth thieves are using a flash player, it doesn't pass a referrer which means the htaccess code won't work (I verified this).  You can try using hot link protection for FLV files from these guys, hotlinkingprotection dot com (although their "free" solution is ioncube encoded), but it should work.  Alternatively if you can find some free/open source tokenization PHP code, or some type of key authentication script to generate time-limited URLs, I can integrate it into the extension.  Mrsdonovan 02:19, 4 March 2010 (UTC)
 * So the path link code from asianmediawiki you don't have any idea how they made their code? Well I would do the redirection like with cgi_img_auth.php for images.

Mrsdonovan 04:06, 6 March 2010 (UTC) I looked at cgi_img_auth.php, but it is darn complicated. I found a simpler solution on a different site using the "symlink" php command: Here is a simple way to control who downloads your files...

You will have to set: $filename, $downloaddir, $safedir and $downloadURL.

Basically $filename is the name of a file, $downloaddir is any dir on your server, $safedir is a dir that is not accessible by a browser that contains a file named $filename and $downloadURL is the URL equivalent of your $downloaddir.

The way this works is when a user wants to download a file, a randomly named dir is created in the $downloaddir, and a symbolic link is created to the file being requested. The browser is then redirected to the new link and the download begins.

The code also deletes any past symbolic links created by any past users before creating one for itself. This in effect leaves only one symbolic link at a time and prevents past users from downloading the file again without going through this script. There appears to be no problem if a symbolic link is deleted while another person is downloading from that link.

This is not too great if not many people download the file since the symbolic link will not be deleted until another person downloads the same file.

Anyway enjoy:

<?php

$letters = 'abcdefghijklmnopqrstuvwxyz'; srand((double) microtime * 1000000); $string = ''; for ($i = 1; $i <= rand(4,12); $i++) { $q = rand(1,24); $string = $string. $letters[$q]; } $handle = opendir($downloaddir); while ($dir = readdir($handle)) { if (is_dir($downloaddir. $dir)){ if ($dir != "." && $dir != ".."){ @unlink($downloaddir . $dir . "/" . $filename); @rmdir($downloaddir . $dir); }  } } closedir($handle); mkdir($downloaddir . $string, 0777); symlink($safedir . $filename, $downloaddir . $string . "/" . $filename); Header("Location: " . $downloadURL . $string . "/" . $filename); ?> Once I figure out how that works, it should be possible to add it to the code.