關於防止檔案下載盜鏈之用js來防止檔案地址盜鏈(二)

來源:互聯網
上載者:User
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
-----------------------------------------------------



相關文章

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。