<%@ Language=VBScript %> <% Response.Buffer = True %> <% 'Configuration Settings VERSION = "2.0" WEBSITE_ID = "6092" AT_SERVER = "www.assoctrac.com" COOKIE_EXPIRES = 3 Response.Cookies("REF")= Request.QueryString("a") Response.Cookies("REF").expires = dateadd("yyyy",2,now) 'Create a new client cookie CC = new_cc() 'Store the cookie on client's machine bake_cookie(CC) 'Redirect the browser to assoctrac.com, into the correct directory, 'and pass it some of the values from %ENV HTTP_PROTOCOL = "http" if ( Request.ServerVariables( "HTTPS" ) = "ON" ) then HTTP_PROTOCOL = "https" end if Response.Redirect( HTTP_PROTOCOL & "://" & AT_SERVER & "/" & WEBSITE_ID & "/track/visit/?CC_" & VERSION & "=" & Server.URLEncode(CC)) 'SUBROUTINES 'Create a CC from scratch function new_cc () dim CC(6,2) CC(0,0) = "QUERY_STRING" CC(1,0) = "COOKIE_EXPIRES" CC(2,0) = "HTTP_REFERER" CC(3,0) = "SCRIPT_NAME" CC(4,0) = "SERVER_NAME" CC(5,0) = "PATH_INFO" CC(0,1) = Request.QueryString CC(1,1) = COOKIE_EXPIRES for i = 2 to 5 CC(i,1) = Request.ServerVariables(CC(i,0)) next new_cc = hash_to_string(CC) end function 'receives a multi-dim array 'returns the CC string function hash_to_string(CC) dim CC_string for i = 0 to 5 if (CC(i,1) > "") then CC_string = CC_string & CC(i,0) & "=" & Server.URLEncode( CC(i,1) ) & "&" end if next hash_to_string = CC_string end function function bake_cookie (cookievalue) Response.Cookies("CC_" & VERSION) = cookievalue Response.Cookies("CC_" & VERSION).path = "/" Response.Cookies("CC_" & VERSION).expires = dateadd("yyyy",COOKIE_EXPIRES,now) end function %>