<!-- #include file="../conn.asp" -->
<!-- #include file="../admin.asp" -->
<%call ling()
Call Head
call saycardd("采集文件")

Dim surl,TP
TP=request("TP")
surl=request("url")
if TP<>"" then
if len(surl)< 10 then
 Response.Write "请正确输入文件地址！<br/>"
 Response.Write	"<anchor>返回上级<prev/></anchor> "
 call headsay()
 response.end
 End if
dim FileExturl
IF InStrRev(surl,".") > 0 THEN
FileExturl = mid(surl,InStrRev(surl,".")+1)
end if

if len(FileExturl)<>3 and len(FileExturl)<>4 then
 Response.Write "请正确输入文件地址！<br/>"
 Response.Write	"<anchor>返回上级<prev/></anchor> "
 call headsay()
 response.end
 End if
idd=request("idd")
lid=request("lid")
if lid<>"" then
lid=clng(lid)
end if
if surl<>"" then
Server.ScriptTimeOut=9999999
function getHTTPPage(url) 
on error resume next 
dim http 
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false 
Http.send() 
if Http.readystate<>4 then 
exit function 
end if 
getHTTPPage=Http.responseBody 
set http=nothing 
if err.number<>0 then err.Clear 
end function 

Function BytesToBstr(body,Cset) 
dim objstream 
set objstream = Server.CreateObject("adodb.stream") 
objstream.Type = 1 
objstream.Mode =3 
objstream.Open 
objstream.Write body 
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = Cset 
BytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
End Function 

function saveimage(from,tofile) 
dim geturl,objStream,imgs 
geturl=trim(from) 
imgs=gethttppage(geturl)'
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type =1 
objStream.Open 
objstream.write imgs
objstream.SaveToFile server.mappath(tofile),2
objstream.Close()
set objstream=nothing 
end function 
RANDOMIZE
sjs=INT((99-00+1)*RND+00)
name=year(date)&month(date)&day(date)&hour(time())&minute(time())&second(time())&sjs
dim ggss
IF InStrRev(surl,".") > 0 THEN
ggss = mid(surl,InStrRev(surl,".")+1)
end if
if ggss<>"asp" and ggss<>"asa" and ggss<>"php" and ggss<>"spx" and ggss<>"jsp" and ggss<>"exe" and ggss<>"aspx" and ggss<>"bat" and ggss<>"dll" and ggss<>"cs"  then
else
 Response.Write "非法文件！<br/>"
 Response.Write	"<anchor>返回上级<prev/></anchor> "
 call headsay()
 response.end
 End if
fname=name&"."&ggss
tofile="/files/"&fname
saveimage surl,tofile 
End If
if fname<>"" and surl<>"" then
response.write "远程地址:"
response.write surl
response.write "<br/>"
response.write "本地地址:"
response.write ""&tofile&""
response.write "<br/>复制:<input name='url"&tt&"' value='"&tofile&"'/>"
response.write "<br/>"

response.write "文件格式:"
response.write ""&ggss&""
response.write "<br/>"
Set fso=CreateObject("Scripting.FileSystemObject") 
Set f=fso.GetFile(server.mappath(""&tofile&"")) 
filesize=f.size 
response.write "文件大小:"
response.write ""&int(filesize/1024)&"KB"
response.write "<br/><a href=""getfiles.asp?sid="&sid&"&amp;saytk="&saytk&""">继续采集</a>"
Else 
response.write "无此文件<br/>"
End If
ELSE
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""getfiles.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if%>
文件地址:<input name="url" value="http://" emptyok="true"/><br/>
<%if saytk>1 then
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
response.write "<input type=""submit"" name=""Submit"" value=""采集文件""></form><br/>"
else%>
<anchor>采集文件<go href='getfiles.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>' method='post'>
<postfield name='url' value='$(url)'/>
<postfield name='TP' value='1'/>
</go></anchor><%end if%>
<br/>提示:采集大文件需用较长时间
<%end if%>
<br/>采集会存放在files文件夹,在文件管理中删除即可.
<br/><a href="index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>">[站长工具]</a><br/>
<a href="../index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>">[后台管理]</a>
<%response.write""
call headsay()%>
