音频文件防盗

| |
[不指定 October 25, 2006 09:17 | by jed ]
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

<?
$URL="http://www.tingroom.com";
$b = $HTTP_REFERER; //获取来源网址
$a = substr($b,0,23);//获取来源网址的前23位,即网站网址,看是否是http://www.tingroom.com
if($b=='')//如果来源网址为空,则直接跳出,不再执行,防止别人直接把此页放在浏览器上查找文件真实地址。
{
exit;        
}

if(strcmp($URL,$a)==0)//如果来源网址跟tingroom域名相匹配,则继续进行。匹配==0。
{
//----数据库连接----///
 require ("config.php");
//------获得$id的值----//
$hou = strpos($b, ".htm");//找到最先出现的".html"地方
$qian = strrpos($b, "/");//找到最后出现的"/"地方
$id = substr($b,$qian+1,$hou-$qian-1);//截取其中的数字

//----要播放的是第 $id 号文件----
$sql  = "select filename from dede_file where id='$id'";
$result    = mysql_query($sql);
if(mysql_num_rows($result) < 1)
{
  //----没有该声音文件----
  exit;
}
$file_name  = mysql_result($result, 0, 'filename');
echo '<EMBED src="http://www.tingroom.com/1234/'.$file_name.'" width=200 height=50
type=audio/x-pn-realaudio-plugin controls="ControlPanel,StatusBar">';
echo '</EMBED>';
exit;
}
else
{  
echo '<EMBED src="http://www.tingroom.com/123.mp3" width=200 height=50
type=audio/x-pn-realaudio-plugin controls="ControlPanel,StatusBar">';
echo '</EMBED>';
exit;
}

?>
Tags:
生活日志 | 评论(0) | 引用(0) | 阅读(1007)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]