%@ LANGUAGE = "VBSCRIPT" %> <% OPTION EXPLICIT %> <% Dim objFSO, objTS, arrData, i, idlength, id, epi, epi2 Const ForReading = 1 'The following constant defines the delimiter used in the text file to separate the id from the URL. Const IdUrlDelimiter = "@" Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Create TextStream object. Here "Redirect\clicks.txt" is the RELATIVE path to the text file. Set objTS = objFSO.OpenTextFile(Server.MapPath("asp\mcafee.asp"), ForReading) 'Read all of the text file data and split the contents into an array. 'Each line in the text file will be input to a separate array element. arrData = Split(Trim(objTS.ReadAll), vbCrLf) 'Cycle through the array of id/link pairs. For i = 0 to UBound(arrData) 'Retrieve the number of characters before the ID/URL Delimiter. idLength = InStr(Trim(arrData(i)), IdUrlDelimiter) - 1 'Retrieve the id from the currently selected item in the array. If idLength = 1 then id = Left(Trim(arrData(i)), 1) ElseIf idLength > 1 then id = Left(Trim(arrData(i)), idLength) Else 'No id found id = 0 End If If Request.Cookies("TRADEDOUBLER_REF") <> "" then epi = "epi(" & Request.Cookies("TRADEDOUBLER_REF") & ")" Else epi = "" End if If Request.Cookies("TD_SEARCH") <> "" then epi2 = "epi2(" & Request.Cookies("TD_SEARCH") & ")" Else epi2 = "" End if 'Test to see if the id passed in the URL matches the id of the currently selected id/link pairing from the array. 'If matched, redirect the user to the associated URL. 'If not matched, continue processing with the next array element. If request.querystring("id") = id then 'response.redirect(Mid(Trim(arrData(i)), idLength + 2) & epi & epi2) %>