php - 如何在 Flash 播放器中隐藏 .flv 文件的 url?

标签 php flash

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

我检查随文件 url 发送的哈希值与服务器上的哈希值,如果它们匹配,则脚本调用以下代码:

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;       
        }
    }

我在标签中使用它(例如,<img src="index.php?id=123&hash=ew6rg5reg4">,它工作得很好。如果图像被热链接,当哈希值每小时(或需要时每分钟)发生变化时,它将停止工作。不幸的是,同样的方法当我使用它将 .flv 文件加载到 Flash 播放器(例如 JW 播放器)时,它不起作用。未加载 .flv 文件。

有什么方法可以解决这个问题或使用替代方法实现相同的效果吗?

最佳答案

您无法真正非常有效地隐藏下载 URL。例如,Safari 公开了通过“事件”窗口下载的所有资源。只需查找大小为 MB 的项目,这就是您的 FLV 文件。

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

关于php - 如何在 Flash 播放器中隐藏 .flv 文件的 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/558653/

相关文章:

flash - 从 .fla 文件中提取 Actionscript,无需 Adob​​e Flash

c# - 人们会喜欢 Flash 到 C# 转换器吗?

php - 这个 php 代码是个坏主意吗?

php - Controller 无法识别 Zend 自定义路由

c# - 如何在 C# 和 Flex 之间共享代码?

actionscript-3 - Actionscript3/Adobe AIR 的 PDF 解析器库

php - As3 & PHP URLEncoding问题!

php - 如何使用vimeo高级API显示视频

php - sh: 2: 1: 未找到 - 将多个 php 参数传递给 bash 脚本

php - 如何在 php 中检索 Parse.com 用户详细信息