• 5982阅读
  • 0回复

[PHP]用PHP输出Flash,防止用户找到Flash源文件 [复制链接]

上一主题 下一主题
离线XChinux
 

只看楼主 倒序阅读 楼主  发表于: 2005-07-18
这是Flash播放页面

<html>
<head>
</head>
<body>
<embed autostart="true" src="download.php" loop="false" menu="true"
quality="high" height="356" width="564" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</body>
</html>


这是发送Flash的文件download.php:

<?php
$file = "file:///d:/work/123456/aa.swf";
if(!file_exists($file))
{
     echo "对不起,此链接已经失效,请在下载页面上向我们报告,谢谢!";
     exit;
}

ob_start();
$file_size = filesize($file);
header("Cache-control: private");
header("Content-Type: application/x-shockwave-flash");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize($file));
header("Content-Disposition: attachment; filename=\"flash.swf\"");

$fp = fopen($file, 'rb');

do
{
  $data = fread($fp, 1024*1024);
  if (strlen($data) == 0)
  {
      break;
  }
  echo($data);
}while(true);
fclose($fp);
?>
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个