<% Dim affiliate_id, banner_tag2, banner_tag3, banner_tag4, banner_tag5 Dim lang Dim InstallFile_name, ConfigFile_name, CodeFile_name '' Output at least max_len WideChar characters to the response object '' using the output_string provided, and skipping the same number of '' characters from the objFile stream provided. Sub OutputStringW(output_string, max_len, objFile) Dim string_len string_len = len(output_string) Response.BinaryWrite(output_string) For i = string_len to max_len-1 Response.BinaryWrite(ChrW(0)) next objFile.Read(max_len*2) End Sub Sub GenerateDetails() '' setup the defaults for these values lang = "en" affiliate_id = "NO_BANNER_TAG" banner_tag2 = "" banner_tag3 = "" banner_tag4 = "" banner_tag5 = "" '' Determine the banner tag for injecting into the installer if (len(Request("banner_tag"))>0) then affiliate_id = Request("banner_tag") end if if (len(Request("btag1"))>0) then affiliate_id = Request("btag1") end if '' see if the other btag values are set if (len(Request("btag2"))>0) then banner_tag2 = Request("btag2") end if if (len(Request("btag3"))>0) then banner_tag3 = Request("btag3") end if if (len(Request("btag4"))>0) then banner_tag4 = Request("btag4") end if if (len(Request("btag5"))>0) then banner_tag5 = Request("btag5") end if '' Determine the language that has been requested (first check "lang", then check "ul") if (len(request("lang")) > 0) then lang = request("lang") end if if (len(Request("ul")) > 0) then lang = Request("ul") end if InstallFile_name = Request("file_name") ConfigFile_name = InstallFile_name + "-" + lang + ".config" CodeFile_name = InstallFile_name + "-" + lang + ".code" End Sub Sub StreamFileToUser() '' get the file ready for streaming Dim file_size, InstallFile Set InstallFile = Server.CreateObject("ADODB.Stream") InstallFile.Open InstallFile.Type = 1 InstallFile.LoadFromFile Server.MapPath(CodeFile_name) '' get the config file ready for streaming Dim ConfigFile Set ConfigFile = Server.CreateObject("ADODB.Stream") ConfigFile.Open ConfigFile.Type = 1 ConfigFile.LoadFromFile Server.MapPath(ConfigFile_name) '' work out the final size of the install program file_size = InstallFile.Size + ConfigFile.Size '' set the headers accordingly Response.Clear() Response.CharSet = "UTF-8" Response.ContentType = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment; filename=""" & InstallFile_name & """" Response.AddHeader "Content-Length", file_size Response.Flush() Response.BinaryWrite(InstallFile.Read(InstallFile.Size)) '' stream the signed install file InstallFile.Close Set InstallFile = Nothing Call OutputStringW(affiliate_id, 256, ConfigFile) '' stream the affiliate ID Call OutputStringW(banner_tag2, 256, ConfigFile) '' stream the custom btags Call OutputStringW(banner_tag3, 256, ConfigFile) Call OutputStringW(banner_tag4, 256, ConfigFile) Call OutputStringW(banner_tag5, 256, ConfigFile) Response.BinaryWrite(ConfigFile.Read(ConfigFile.Size-ConfigFile.Position)) '' stream the rest of the config file ConfigFile.Close Set ConfigFile = Nothing End Sub Call GenerateDetails() '' work out the bannertags, filenames and user language settings Call StreamFileToUser() '' stream the file to the user. %>