关于防止文件下载盗链之用js来防止文件地址盗链(二)

80酷酷网    80kuku.com

  js|下载

Music.htm
-----------------
<html>
<head>
<title>PlayMusic</title>
<script language=jscript src=Play_url.js></script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bgcolor="#999999">
<TABLE cellSpacing=0 cellPadding=0 width=468 align=center border=0>
  <!--DWLayoutTable-->
  <TBODY>
    <TR>
      <TD width="468" height=60 align=middle valign="top"><font size="2">您现在收听的是:</font><font color="#FF0000" size=2>
        <script language="javascript">
  if(wor==undefined)
   {
      document.write("无曲目")
   }
      else 
  document.write(wor)
  </script>
        </font></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE height=60 cellSpacing=0 cellPadding=0 width=468 align=center border=0>
  <TBODY>
  <TR>
    <TD class=box bgColor=#eeeeee height=60 align="center">
 <div align="center">
<script language="javascript" src="MP.js"></script>
</div>
</TD>
</TR>
</TBODY>
</TABLE>
<div align="center">
</body>
</html>
上面有一段引入了两段js的代码Play_url.js,MP.js这里就是关键了。接下来我们就来看看这段代码。
-------------------------------------------------------------------------------------------
****************************************************************************
MP.jps
---------------------------------
document.write ("<OBJECT id=Player2 name=Player classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 border=\"0\" width=100% height=68 type=application/x-oleobject standby=\"Loading Windows Media Player components...\">\n")
document.write ("<param name=\"AudioStream\" value=\"-1\">\n")
document.write ("<param name=\"AutoSize\" value=\"0\">\n")
document.write ("<param name=\"AutoStart\" value=\"-1\">\n")
document.write ("<param name=\"AnimationAtStart\" value=\"-1\">\n")
document.write ("<param name=\"AllowScan\" value=\"-1\">\n")
document.write ("<param name=\"AllowChangeDisplaySize\" value=\"-1\">\n")
document.write ("<param name=\"AutoRewind\" value=\"0\">\n")
document.write ("<param name=\"Balance\" value=\"10\">\n")
document.write ("<param name=\"BaseURL\" value>\n")
document.write ("<param name=\"BufferingTime\" value=\"5\">\n")
document.write ("<param name=\"CaptioningID\" value>\n")
document.write ("<param name=\"ClickToPlay\" value=\"-1\">\n")
document.write ("<param name=\"CursorType\" value=\"0\">\n")
document.write ("<param name=\"CurrentPosition\" value=\"-1\">\n")
document.write ("<param name=\"CurrentMarker\" value=\"0\">\n")
document.write ("<param name=\"DefaultFrame\" value>\n")
document.write ("<param name=\"DisplayBackColor\" value=\"0\">\n")
document.write ("<param name=\"DisplayForeColor\" value=\"16777215\">\n")
document.write ("<param name=\"DisplayMode\" value=\"0\">\n")
document.write ("<param name=\"DisplaySize\" value=\"4\">\n")
document.write ("<param name=\"Enabled\" value=\"-1\">\n")
document.write ("<param name=\"EnableContextMenu\" value=\"0\">\n")
document.write ("<param name=\"EnablePositionControls\" value=\"-1\">\n")
document.write ("<param name=\"EnableFullScreenControls\" value=\"0\">\n")
document.write ("<param name=\"EnableTracker\" value=\"-1\">\n")
document.write ("<param name=\"Filename\" value='" + str + "'>\n")
document.write ("<param name=\"InvokeURLs\" value=\"-1\">\n")
document.write ("<param name=\"Language\" value=\"-1\">\n")
document.write ("<param name=\"Mute\" value=\"0\">\n")
document.write ("<param name=\"PlayCount\" value=\"0\">\n")
document.write ("<param name=\"PreviewMode\" value=\"0\">\n")
document.write ("<param name=\"Rate\" value=\"1\">\n")
document.write ("<param name=\"SAMILang\" value>\n")
document.write ("<param name=\"SAMIStyle\" value>\n")
document.write ("<param name=\"SAMIFileName\" value>\n")
document.write ("<param name=\"SelectionStart\" value=\"0\">\n")
document.write ("<param name=\"SelectionEnd\" value=\"0\">\n")
document.write ("<param name=\"SendOpenStateChangeEvents\" value=\"-1\">\n")
document.write ("<param name=\"SendWarningEvents\" value=\"-1\">\n")
document.write ("<param name=\"SendErrorEvents\" value=\"-1\">\n")
document.write ("<param name=\"SendKeyboardEvents\" value=\"0\">\n")
document.write ("<param name=\"SendMouseClickEvents\" value=\"0\">\n")
document.write ("<param name=\"SendMouseMoveEvents\" value=\"0\">\n")
document.write ("<param name=\"SendPlayStateChangeEvents\" value=\"-1\">\n")
document.write ("<param name=\"ShowCaptioning\" value=\"0\">\n")
document.write ("<param name=\"ShowControls\" value=\"-1\">\n")
document.write ("<param name=\"ShowAudioControls\" value=\"-1\">\n")
document.write ("<param name=\"ShowDisplay\" value=\"0\">\n")
document.write ("<param name=\"ShowGotoBar\" value=\"0\">\n")
document.write ("<param name=\"ShowPositionControls\" value=\"-1\">\n")
document.write ("<param name=\"ShowStatusBar\" value=\"-1\">\n")
document.write ("<param name=\"ShowTracker\" value=\"-1\">\n")
document.write ("<param name=\"TransparentAtStart\" value=\"0\">\n")
document.write ("<param name=\"VideoBorderWidth\" value=\"0\">\n")
document.write ("<param name=\"VideoBorderColor\" value=\"0\">\n")
document.write ("<param name=\"VideoBorder3D\" value=\"0\">\n")
document.write ("<param name=\"Volume\" value=\"0\">\n")
document.write ("<param name=\"WindowlessVideo\" value=\"0\">\n")
document.write ("<embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" Name=\"Player\" width=\"300\" height=\"66\" border=\"0\" SHOWSTATUSBAR=\"-1\" SHOWCONTROLS=\"0\" SHOWGOTOBAR=\"0\" SHOWDISPLAY=\"-1\" INVOKEURLS=\"-1\" AUTOSTART=\"1\" CLICKTOPLAY=\"0\" DisplayForeColor=\"12945678\">\n")
document.write ("</OBJECT>\n")

----------------------------------------------
************************************
Play_url.js
----------------------
<script language="JavaScript" type="text/JavaScript">
var searchString=location.search           // <---------取出传递过来的参数
var pos=searchString.indexOf("?url=")            
if (pos==0){


  var str,str1,arr,wor;
  arr=searchString.split('&');                    //<----------把地址和歌名分离
  if (arr.length > 1){
    wor=arr[1];
  }
  else{
   wor="";
  }
// 下面这段就是这里的关键,刚才的那一段字符串就在这里解码,明白了吗?
str=arr[0].substr(5,searchString.length);
str=str.replace(/YVI/g,"1")
str=str.replace(/ESR/g,"2")
str=str.replace(/SXN/g,"3")
str=str.replace(/STI/g,"4")
str=str.replace(/WFU/g,"5")
str=str.replace(/LQU/g,"6")
str=str.replace(/QGI/g,"7")
str=str.replace(/BLA/g,"8")
str=str.replace(/JFU/g,"9")
str=str.replace(/LSN/g,"0")
str=str.replace(/XPG/g,"/")
str=str.replace(/XQD/g,".")
str=str.replace(/ /g,"")
str=str.replace(/%20/g,"")
str=str.replace(/KWD/g,"MP3")
str="127.0.0.1//MusicMP3/" + str
document.write(str)
}
</script>


------------------------------------------------------------------------
********************************
关于防止文件下载盗链之用js来防止文件地址盗链(一) http://blog.csdn.net/bluedestiny/archive/2004/09/23/114104.aspx
-----------------------------------------------------



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: