<% ’ (c) 2005 All rights reserved link-vault.com dim lv_ScriptVersion lv_ScriptVersion = ”1.4.01” Server.ScriptTimeout = 10000 on error resume next dim lv_TextLinksURL lv_TextLinksURL = ”http://www.link-vault.com/comms.asp?sc=98kW8lPr6aHvTPpa” dim lv_p, lv_q, lv_DLsp if right(Request.ServerVariables(”SCRIPT_NAME”),22) = ”lv98kW8lPr6aHvTPpa.asp” then Select Case Request(”action”) case ”resetsite” Application(”Reseting”) = True Application(”URLs”) = GetHTTP(lv_TextLinksURL & ”&action=givemeallurls”) Application(”URLCount”) = (len(Application(”URLs”)) – len(Replace(Application(”URLs”),””,””,1,-1,vbTextCompare)))/5
Application(”NewURLs”) = ””
Application(”NewURLCount”) = 0
Application(”Links”) = GetHTTP(lv_TextLinksURL & ”&action=givemealllinks”)
Application(”LinkOnURLs”) = GetHTTP(lv_TextLinksURL & ”&action=givemeallplacements”)
Application(”LastCommunication”) = Now()
Application(”TestMode”) = (Request(”testmode”) = ”on”)
Application(”MaxPages”) = Request(”maxpages”)
Application(”Reseting”) = False
%>success<% case ”getnewlinks” Application(”Links”) = GetHTTP(lv_TextLinksURL & ”&action=givemealllinks”) Application(”LinkOnURLs”) = GetHTTP(lv_TextLinksURL & ”&action=givemeallplacements”) %>success<% case ”newurl” if instr(1,Application(”URLs”),”” & Request(”NewURL”) & ”” & Request(”Slots”) & ”:” & Request(”URLID”),vbTextCompare) = 0 then
lv_p = instr(1,Application(”URLs”),”” & Request(”NewURL”) & ””,vbTextCompare)
lv_q = instr(lv_p+1,Application(”URLs”),””,vbTextCompare)
if lv_p > 0 then
if lv_p = 1 then
if lv_q > 0 then
Application(”URLs”) = mid(Application(”URLs”),lv_q)
else
Application(”URLs”) = ””
end if
else
if lv_q > 0 then
Application(”URLs”) = left(Application(”URLs”),lv_p-1) & mid(Application(”URLs”),lv_q)
else
Application(”URLs”) = left(Application(”URLs”),lv_p-1)
end if
end if
end if
Application(”URLs”) = Application(”URLs”) & ”” & Request(”NewURL”) & ”” & Request(”Slots”) & ”:” & Request(”URLID”)
end if
case ”getnewurls”
if Application(”NewURLs”) <> ”” then
%><%=Application(”NewURLs”)%><% Application(”NewURLCount”) = 0 Application(”NewURLs”) = ”” end if Application(”TestMode”) = (Request(”testmode”) = ”on”) case ”settestmode” Application(”TestMode”) = (Request(”testmode”) = ”on”) %>success<% case ”getscriptversion” %><%=lv_ScriptVersion%><% case ”commscheck” %><%=GetHTTP(lv_TextLinksURL & ”&action=commscheck”)%><% end select Response.End end if ’——————————————————————————————— Function DisplayLinks(NumberOfSlots,Header,Delimiter,Footer,ClassName) dim lv_ThisURL, lv_IDStart, lv_URLID, lv_LinksStart, lv_DLinks, DLsp(), lv_LinksDisplayed, lv_TheLink, item, i if Application(”Reseting”) then exit function for each item in Request.QueryString if len(Request.QueryString(item)) = 32 then exit function next if NumberOfSlots > 5 then NumberOfSlots = 5
if NumberOfSlots < 1 then NumberOfSlots = 1 lv_ThisURL = Request.ServerVariables(”REQUEST_URI”) if lv_ThisURL = ”” then lv_ThisURL = Request.ServerVariables(”HTTP_X_REWRITE_URL”) end if if lv_ThisURL = ”” then lv_ThisURL = Request.ServerVariables(”PATH_INFO”) if Request.QueryString <> ”” then
lv_ThisURL = lv_ThisURL & ”?” & Request.QueryString
end if
end if
if lv_ThisURL = ”” then
lv_ThisURL = Request.ServerVariables(”SCRIPT_NAME”)
if Request.QueryString <> ”” then
lv_ThisURL = lv_ThisURL & ”?” & Request.QueryString
end if
end if
if Application(”URLs”) = ”” and Application(”Reseting”) = ”” then
Application(”Reseting”) = True
Application(”URLs”) = GetHTTP(lv_TextLinksURL & ”&action=givemeallurls”)
Application(”URLCount”) = (len(Application(”URLs”)) – len(Replace(Application(”URLs”),””,””,1,-1,vbTextCompare)))/5
Application(”NewURLs”) = ””
Application(”NewURLCount”) = 0
Application(”Links”) = GetHTTP(lv_TextLinksURL & ”&action=givemealllinks”)
Application(”LinkOnURLs”) = GetHTTP(lv_TextLinksURL & ”&action=givemeallplacements”)
Application(”LastCommunication”) = Now() – 1
Application(”TestMode”) = (GetHTTP(lv_TextLinksURL & ”&action=givemetestmode”) = ”on”)
Application(”MaxPages”) = GetHTTP(lv_TextLinksURL & ”&action=givememaxpages”)
Application(”Reseting”) = False
end if
if Application(”TestMode”) then
%>Page : <%=lv_ThisURL%> : <% end if if Application(”URLs”) = ”” and Application(”NewURLs”) = ”” then Application(”NewURLs”) = ”” & lv_ThisURL & ”” & NumberOfSlots
Application(”NewURLCount”) = 1
else
if instr(1,Application(”URLs”),”” & lv_ThisURL & ””,vbTextCompare) = 0 then
if Application(”MaxPages”) > Application(”URLCount”) and instr(1,Application(”NewURLs”),”” & lv_ThisURL & ””,vbTextCompare) = 0 then
Application(”NewURLs”) = Application(”NewURLs”) & ”” & lv_ThisURL & ”” & NumberOfSlots
Application(”NewURLCount”) = Application(”NewURLCount”) + 1
Application(”URLCount”) = Application(”URLCount”) + 1
end if
else
if instr(1,Application(”URLs”),”” & lv_ThisURL & ”” & NumberOfSlots,vbTextCompare) = 0 then
Application(”NewURLs”) = Application(”NewURLs”) & ”” & lv_ThisURL & ”” & NumberOfSlots
Application(”NewURLCount”) = Application(”NewURLCount”) + 1
Application(”URLCount”) = Application(”URLCount”) + 1
end if
lv_IDStart = instr(1,Application(”URLs”),”” & lv_ThisURL & ””,vbTextCompare) + len(”” & lv_ThisURL & ””)
lv_IDStart = instr(lv_IDStart,Application(”URLs”),”:”) + 1
if lv_IDStart > 1 then
if instr(lv_IDStart,Application(”URLs”),”<”) > 0 then
lv_URLID = mid(Application(”URLs”),lv_IDStart,instr(lv_IDStart,Application(”URLs”),”<”)-lv_IDStart) else lv_URLID = mid(Application(”URLs”),lv_IDStart) end if lv_LinksStart = instr(1,Application(”LinkOnURLs”),”U” & lv_URLID & ”;”,vbTextCompare) + len(lv_URLID) + 2 if lv_LinksStart > len(lv_URLID) + 2 then
lv_DLinks = mid(Application(”LinkOnURLs”),lv_LinksStart,instr(lv_LinksStart,Application(”LinkOnURLs”),”:”)-lv_LinksStart)
lv_DLsp = Split(lv_DLinks,”,”)
lv_LinksDisplayed = 0
for i = 0 to ubound(lv_DLsp)
lv_LinksStart = instr(1,Application(”Links”),”<LINK” & lv_DLsp(i) & ”>”,vbTextCompare) + len(lv_DLsp(i)) + 6
if lv_LinksStart > 6 then
if lv_LinksDisplayed > 0 then
%><%=Delimiter%><% else %><%=Header%><% end if lv_TheLink = mid(Application(”Links”),lv_LinksStart,instr(lv_LinksStart,Application(”Links”),””,vbTextCompare)-lv_LinksStart)
if ClassName <> ”” then
lv_TheLink = Replace(lv_TheLink,”””>”,””” class=””” & ClassName & ”””>”,1,-1,vbTextCompare)
end if
%><%=lv_TheLink%><% lv_LinksDisplayed = lv_LinksDisplayed + 1 end if next end if end if end if end if if Application(”TestMode”) then if lv_LinksDisplayed = 0 then %><%=Header%><% end if for i = lv_LinksDisplayed + 1 to NumberOfSlots if i > 1 then
%><%=Delimiter%><% end if %> ”” then
%> class=”<%=ClassName%>”<% end if %>>TestLink<%=i%><% next lv_LinksDisplayed = NumberOfSlots end if if lv_LinksDisplayed > 0 then
%><%=Footer%><% end if Application(”NewURLCount”) = (len(Application(”NewURLs”)) – len(Replace(Application(”NewURLs”),””,””,1,-1,vbTextCompare)))/5
if (Application(”NewURLCount”) > 9 or (Application(”NewURLCount”) > 0 and abs(DateDiff(”n”,Application(”LastCommunication”),now)) > 15)) then
if abs(DateDiff(”s”,Now(),Application(”LastCommunication”))) > 60 then
Application(”LastCommunication”) = now()
GetHTTP lv_TextLinksURL & ”&action=talktome”
end if
end if
end function
’———————————————————————————————
Private Function GetHTTP(File)
Dim wHTTP
Set wHTTP = server.CreateObject(”WinHttp.WinHttpRequest.5.1”)
wHTTP.settimeouts 2000,2000,5000,60000
wHTTP.Open ”GET”, File, false
wHTTP.Send
If wHTTP.WaitForResponse(5) = True Then
GetHTTP = wHTTP.ResponseText
End If
Set wHTTP=nothing
end function
’———————————————————————————————
%>