当前位置: 代码迷 >> ASP >> 请大家伙儿帮忙看看,为什么这段代码有的能替换有的不能替换
  详细解决方案

请大家伙儿帮忙看看,为什么这段代码有的能替换有的不能替换

热度:1221   发布时间:2014-02-27 01:51:21.0
请大家帮忙看看,为什么这段代码有的能替换有的不能替换
		Dim m_playurl,mcj,mcj1,mcj2,mcj3,mcj4,mcj5,mcj6,mcj7,mcj8
m_playurl="^var govspx19613=""Fi7.imgs.letv.com%"";var n35754=""Bbdhd%3A%"";var pp_play=""DVD%E7%89%88%67876365edczd""+2+""B%""+2+""Bhttp%3A%""+2+""F%""+2+govspx19613+2+'6722027pargu'+2+""FswfPlayer.swf%3FautoPlay%3D1%20856457fkluy""+2+""6id%3D19""+2+""873944308ejueb""""+2+'55874932icwhx'+2+""""4%""+2+""4%""+2+'26169293estac'+2+""B%""+2+n35754+2+""F%""+2+""F""+2+""9985609%7CEB961064E957D941D3E65A11587F44413067367tocpc""+2+""%7C%E8%B8%AE%E8%B5%B7%E8%84%9A%E5%B0%96+%E5%BE%AE%E7%94%B5%E5%BD%B1.flv""+2+"""";pp_play=pp_play.replace(""67876365edczd"","""").replace(""6722027pargu"",""Fplayer%"").replace('20856457fkluy','').replace(""73944308ejueb"","""").replace(""55874932icwhx"",""31%"").replace(""26169293estac"",""4DVD%E7%89%88%"").replace(""13067367tocpc"","""");pp_play=pp_play.substring(0,pp_play.length-1);"
mcj=extract(m_playurl,"^","var pp_play")
mcj5=extract(m_playurl,";pp_play=pp_play",";")
mcj4=extract(m_playurl,"var pp_play=",";")
  if mcj<>"" then
  mcj = split(mcj,";")
  for i = 0 to Ubound(mcj) 
if trim(mcj(i))<>"" then
mcj1=split(replace(mcj(i),"var ",""),"=")
mcj2=mcj1(0)
mcj3=mcj1(1)
mcj4 = replace(mcj4,mcj2,mcj3)
end if
  next
  end if
  if mcj5<>"" then
  mcj8=mcj4
  mcj5 = split(mcj5,".replace")
  for j = 0 to Ubound(mcj5) 
if trim(mcj5(j))<>"" then
mcj6=extract(mcj5(j),"(",",")
mcj6=replace(replace(mcj6,chr(34),""),"'","")
mcj7=extract(mcj5(j),","&chr(34),chr(34)&")")
mcj4 = replace(mcj8,mcj6,mcj7)
end if
  next   
  end if
  Response.write mcj4
function extract(from,s_start,s_end)'取指定字符中间的字符
dim pos_start,pos_end,rtn
rtn="" 
pos_start=instr(from,s_start)
if pos_start>0 then
pos_start=pos_start+len(s_start)
pos_end=instr(pos_start,from,s_end)
if pos_end > pos_start then
rtn=mid(from,pos_start,pos_end-pos_start)
end if
end if
extract=rtn
end function


上面的代码只能替换成这样的:
"DVD%E7%89%88%67876365edczd"+2+"B%"+2+"Bhttp%3A%"+2+"F%"+2+"Fi7.imgs.letv.com%"+2+'6722027pargu'+2+"FswfPlayer.swf%3FautoPlay%3D1%20856457fkluy"+2+"6id%3D19"+2+"873944308ejueb""+2+'55874932icwhx'+2+""4%"+2+"4%"+2+'26169293estac'+2+"B%"+2+"Bbdhd%3A%"+2+"F%"+2+"F"+2+"9985609%7CEB961064E957D941D3E65A11587F444"+2+"%7C%E8%B8%AE%E8%B5%B7%E8%84%9A%E5%B0%96+%E5%BE%AE%E7%94%B5%E5%BD%B1.flv"+2+""

正确的应该是:
DVD%E7%89%88%2B%2Bhttp%3A%2F%2Fi7.imgs.letv.com%2Fplayer%2FswfPlayer.swf%3FautoPlay%3D1%26id%3D1928231%24%24%24DVD%E7%89%88%2B%2Bbdhd%3A%2F%2F29985609%7CEB961064E957D941D3E65A11587F4442%7C%E8%B8%AE%E8%B5%B7%E8%84%9A%E5%B0%96+%E5%BE%AE%E7%94%B5%E5%BD%B1.flv

<script language="javascript" runat="server">
var str=Request.Form("m_playurl");
str=eval(str + "");   //保证是String 类型
</script>
<%
Response.write str
%>