<% Const OpenFileForReading = 1 Const OpenFileForWriting = 2 Const OpenFileForAppending = 8 Const adTypeBinary = 1 function CreateTempFile(name) if InStr(LCase(Request.ServerVariables(«HTTP_ACCEPT_ENCODING»)), LCase(«gzip»))=0 then CreateTempFile =»» else Randomize pPath=Request.ServerVariables(«APPL_PHYSICAL_PATH») if Len(name)=0 then filename= pPath +»c_»+CStr(Int(1001 * Rnd)) else filename= pPath +name end if filename=Replace(filename,»»,»») Set fso = CreateObject(«Scripting.FileSystemObject») Set tf = fso.CreateTextFile(filename+».txt», True) tf.Close Set tf = Nothing Set fso = Nothing CreateTempFile = filename end if end function sub Write(filename,str) if Len(filename)=0 then Response.write(str) else Dim fso, tf Set fso = CreateObject(«Scripting.FileSystemObject») Set tf = fso.OpenTextFile(filename+».txt», OpenFileForAppending, True, TristateFalse) tf.Write(CStr(str)) tf.Close Set tf = Nothing Set fso = Nothing end if end sub function Compress(filename) if Len(filename)>0 then command=»cmd /c gzip.exe -c -n -a -9 «+filename+».txt > «+filename+».gz» Set WshShell = CreateObject(«WScript.Shell») WshShell.Run command,0,true Set WshShell=Nothing end if end function function Send(filename) if Len(filename)>0 then Response.AddHeader «content-encoding», «gzip» Set objStream = Server.CreateObject(«ADODB.Stream») objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile filename+».gz» Response.BinaryWrite objStream.Read objStream.Close Set objStream = Nothing end if end function function DeleteFiles(filename) if Len(filename)>0 then Set fso = CreateObject(«Scripting.FileSystemObject») fso.DeleteFile(filename) Set fso = Nothing end if end function %>