<%@ Language=VBScript %>
<%
' Local file to store XML
' You must create a blank file named "local_226046.xml" in the same
' directory as this script. It MUST be writable by the web
' server. On unix you would CHMOD 666 the file. On Windows
' you will need to access your custom control panel to set
' the permissions or contact your hosting company.
Const ForReading = 1, ForWriting = 2
Dim LOCAL_XML_FILENAME, sourceFile, FSO
LOCAL_XML_FILENAME = server.MapPath("local_226046.xml")
sourceFile = "http://www.text-link-ads.com/xml.php?inventory_key=A5ZYC41FZ810BBXGWUT4&referer=" & Server.UrlEncode(Request.ServerVariables("HTTP_REFERER")) & "&user_agent=" & Server.UrlEncode(Request.ServerVariables("HTTP_USER_AGENT"))
Set FSO = server.createObject("Scripting.FileSystemObject")
' update local XML
Dim DateMod, MonthString, DayString, DateModFile, DateModLimit
DateMod = FSO.getFile(LOCAL_XML_FILENAME).DateLastModified
MonthString = Month(DateMod)
If (MonthString < 10) Then
MonthString = "0" & MonthString
End If
DayString = Day(DateMod)
If (DayString < 10) Then
DayString = "0" & DayString
End If
DateModFile = Year(DateMod) & "-" & MonthString & "-" & DayString & " " & Hour(DateMod) & ":" & Minute(DateMod) & ":" & Second(DateMod)
MonthString = Month(Date)
If (MonthString < 10) Then
MonthString = "0" & MonthString
End If
DayString = Day(Date)
If (DayString < 10) Then
DayString = "0" & DayString
End If
DateModLimit = Year(Date) & "-" & MonthString & "-" & DayString & " " & (Hour(Now)-1) & ":" & Minute(Now) & ":" & Second(Now)
Dim Contents, Result, xmlhttp, TextStream
' read local XML
Contents = ""
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForReading, False, -2)
Do While Not TextStream.AtEndOfStream
Contents = Contents & TextStream.ReadLine
Loop
TextStream.Close
Set TextStream = nothing
If (DateModFile < DateModLimit Or FSO.getFile(LOCAL_XML_FILENAME).size < 20) Then
' fetch remote XML
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", sourceFile, False
xmlhttp.send ""
Result = xmlhttp.responseText
If (Result <> "") Then
Contents = Result
End If
' write new XML to local file
Set TextStream = FSO.OpenTextFile(LOCAL_XML_FILENAME, ForWriting, True)
TextStream.Write Contents
TextStream.Close
Set TextStream = nothing
End If
' parse local XML
Dim source
Set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadXML(Contents)
' Output links
Dim objLst, i, numLinks, objLink, objLinkChildren, linkNode, URL, Text, BeforeText, AfterText
Set objLst = source.getElementsByTagName("Link")
numLinks = objLst.length - 1
Response.Write("")
For i = 0 To numLinks
Set objLink = objLst.item(i)
Set objLinkChildren = objLink.childNodes
URL = ""
Text = ""
BeforeText = ""
AfterText = ""
For Each linkNode In objLinkChildren
If linkNode.nodeName = "URL" Then
URL = linkNode.text
End If
If linkNode.nodeName = "Text" Then
Text = linkNode.text
End If
If linkNode.nodeName = "BeforeText" Then
BeforeText = linkNode.text
End If
If linkNode.nodeName = "AfterText" Then
AfterText = linkNode.text
End If
Next
Response.Write("- " & BeforeText & " " & Text & " " & AfterText & "
")
Next
Response.Write(" ")
%>
<%
' ********************************************************************
' Paste this block of code on your web page where you would like text
' links to be displayed. This code will dynamically add and remove text
' links on your web page according to your BackLinks.com settings.
' ********************************************************************
Dim BLKey
Dim OpenInNewWindow
Dim PostingString
Dim ErrorString
Dim ResultString
Dim LinkUrl
' The following variable defines whether links are opened in a new window
' (1 = Yes, 0 = No)
OpenInNewWindow = 1
' *******************************************************************
' please do not modify any of the code below
' *******************************************************************
BLKey = "043Y-9UHV-II1F"
' # The following variable is sent to the BackLinks server in order to
' # generate working links on your page:
If Request.ServerVariables("HTTPS") = "on" Then LinkUrl="https://" Else LinkUrl="http://" End If
If Request.ServerVariables("REQUEST_URI") Then
LinkUrl = LinkUrl & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("REQUEST_URI")
Else
LinkUrl = LinkUrl & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("PATH_INFO")
If Request.ServerVariables("QUERY_STRING") <> "" Then LinkUrl = LinkUrl & "?" & Request.ServerVariables("QUERY_STRING") End If
End If
LinkUrl = server.URLencode(LinkUrl)
' # Generate the data to post to the BackLinks.com server
PostingString = "&Key=" & BLKey
PostingString = PostingString & "&OpenInNewWindow=" & OpenInNewWindow & "&LinkUrl=" & LinkUrl
Function GetBackLinksData(HTTPQuery, ByRef Resp, ByRef Er)
Dim HttpReqObj
Set HttpReqObj = Nothing
On Error Resume Next
Set HttpReqObj = CreateObject("WinHttp.WinHttpRequest.5.1")
On Error Resume Next
If HttpReqObj Is Nothing Then Set HttpReqObj = CreateObject("WinHttp.WinHttpRequest.5") End If
On Error Resume Next
If HttpReqObj Is Nothing Then
On Error Resume Next
Set HttpReqObj = CreateObject("Msxml2.ServerXMLHTTP")
On Error Resume Next
If HttpReqObj Is Nothing Then
Set HttpReqObj = CreateObject("Msxml2.ServerXMLHTTP.4.0")
End If
On Error Resume Next
If HttpReqObj Is Nothing Then
Set HttpReqObj = CreateObject("Microsoft.XMLHTTP")
End If
On Error Resume Next
If HttpReqObj Is Nothing Then
Er = "HTTP requests not supported."
GetBackLinksData = False
Else
HttpReqObj.open "GET", "http://www.backlinks.com/engine.php?" & HTTPQuery, false
HttpReqObj.Send
If HttpReqObj.status <> 200 Then
Er = "Error: Status=" & HttpReqObj.status & " Text='" & HttpReqObj.responseText & "'"
GetBackLinksData = False
Else
Resp = HttpReqObj.responseText
GetBackLinksData = True
End If
Set HttpReqObj = Nothing
End If
Else
HttpReqObj.Open "GET", "http://www.backlinks.com/engine.php?" & HTTPQuery, False
HttpReqObj.Send
If HttpReqObj.Status <> 200 Then
Er = "Error: Status=" & HttpReqObj.Status & " Text=" & HttpReqObj.ResponseText
GetBackLinksData = False
Else
Resp = HttpReqObj.responseText
GetBackLinksData = True
End If
End If
End Function
If GetBackLinksData(PostingString, ResultString, ErrorString) Then
Response.Write ResultString
Else
Response.Write ErrorString
End If
' FINSIHED BackLinks.COM SCRIPT BLOCK
%>
|