如何将.flv文件的网址隐藏在Flash播放器中? [英] How do you hide the url of the .flv file in a flash player?

查看:125
本文介绍了如何将.flv文件的网址隐藏在Flash播放器中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用到期的网址来隐藏我在我的网站上使用的图像的网址,以便它们只能在哈希(1小时)的生命周期内被热链接。



我检查与文件url一起发送的散列值,并与服务器上的散列值进行比较,如果匹配,脚本将调用以下代码:

  if(isset($ _ GET [hash])){
$ this_min = date('Ymd-g',time())。 盐 。 $ VID_ID;
$ current_hash = substr(md5($ this_min),0,12);
$ submitted_hash = mysql_real_escape_string($ _ GET [hash]);
if($ current_hash==$ submitted_hash){
$ file_url2 =directory /。 $ vid_file;
header('Content-Type:application / octet-stream');
header(Content-Transfer-Encoding:Binary);
header(Content-disposition:inline; filename = \。md5($ vid_file)。\);
readfile($ file_url2);
出口;
} else {
$ _SESSION [message] =下载链接过期,刷新页面,然后重试;
$ _SESSION [message_type] = 0;
header(Location:。$ _SERVER ['HTTP_REFERER']);
出口;




$ b我在标签中使用了这个(例如,



$ code>< img src =index.php?id = 123& hash = ew6rg5reg4>
,它的工作原理是完美的,如果图像被热链接,更改,每小时(如果需要的话),不幸的是,当我用它来加载.flv文件到一个Flash播放器,如JW播放器时,这种方法不起作用,没有加载.flv文件。 >

有什么办法可以解决这个问题,或者用另一种方法实现同样的功能吗?

解决方案

您无法真正隐藏下载网址,例如,Safari会通过活动窗口公开所有下载的资源,只需查找MB大小的项目,即您的FLV文件。 b
$ b

防止人们抓取您的FLV的唯一方法是使用RTMP流式传输,他们永远无法访问完整文件。


I use expiring urls to hide the urls of images I use on my sites, so that they can only be hotlinked for the duration of the life of the hash (1 hour).

I check the hash sent with the file url, against a hash on the server, if they match, the script calls the following code:

if (isset($_GET["hash"])) {
        $this_min = date('Y-m-d-g',time()) . "salt" . $vid_id;
        $current_hash =  substr(md5($this_min),0,12);
        $submitted_hash = mysql_real_escape_string($_GET["hash"]);
        if ("$current_hash" == "$submitted_hash") {
            $file_url2 = "directory/" .  $vid_file;
            header('Content-Type: application/octet-stream');
            header("Content-Transfer-Encoding: Binary"); 
            header("Content-disposition: inline; filename=\"".md5($vid_file)."\""); 
            readfile($file_url2);
            exit;
        } else {
            $_SESSION["message"] = "Download link expired, refresh the page and try again";
            $_SESSION["message_type"] = 0;
            header("Location:" . $_SERVER['HTTP_REFERER']);
            exit;       
        }
    }

I use this in an tag (for example, <img src="index.php?id=123&hash=ew6rg5reg4">and it works perfectly. If the image is hotlinked, it will stop working when the hash changes, every hour (or minute if necessary). Unfortunately, this same method doesn't work when I use it to load .flv files into a flash player, such as the JW player . No .flv file is loaded.

Any way I can fix this or achieve the same thing with an alternate method?

解决方案

You can't really hide a downloading URL very effectively. Safari, for example, exposes all resources downloaded via the Activity window. Just look for the item that is MB in size and that's your FLV file.

The only way to keep people from ripping your FLVs is to use RTMP streaming, where they never get access to the full file.

这篇关于如何将.flv文件的网址隐藏在Flash播放器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆