<%
'' REFERER-JS.ASP
'' Sean P. Nolan
'' http://www.yaywastaken.com/
''
'' This code is free for you to use as you see fit. Copy it, rewrite it,
'' run it yourself, whatever. But no warranties or guarantees either. Who
'' knows what the hell it does. Not me, that's for sure!
''
'' Get recent referers as javascript document.write.
''
'' site - name of requested site (as given to referer.asp)
'' url - url of requested site
'' xsl - optional url for stylesheet to apply to RSS/CHANNEL feed
'' maxitems - optional max on number of items to retrieve; default 10
'' qry - "recent" or "popular", defines which type of list to fetch
'' maxlen - optional; truncate TITLES to this length
'' maxwordlen - optional; breaks words in TITLE longer than this w/spaces
'' notitle - optional; display raw URLs instead of TITLE tags
'' daysago - optional; if qry is "popular" date range to search in days
''
%>
<!--#include file="referer-inc.asp" -->
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' TransformRSS
Function TransformRSS(knex, szXSL)
Dim szRSS, xml, xsl, xmlhttp
szRSS = GetRefererRSS(g_knex)
Set xml = Server.CreateObject("Msxml2.DOMDocument")
xml.async = False
xml.loadXML(szRSS)
Set xsl = Server.CreateObject("Msxml2.DOMDocument")
xsl.async = False
If (LCase(Left(szXSL, 4)) = "http") Then
Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
xmlhttp.open "GET", szXSL, False
xmlhttp.send ""
If (xmlhttp.status <> 200) Then
Exit Function
End If
xsl.loadXML(xmlhttp.responseText)
Else
xsl.load(szXSL)
End If
TransformRSS = xml.transformNode(xsl)
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Mainline
Dim g_knex, g_szXSL, g_szHTML
g_szXSL = Request("xsl")
If (g_szXSL = "") Then
g_szXSL = Server.MapPath("default.xsl")
ElseIf (Left(g_szXSL, 1) = "!") Then
g_szXSL = Server.MapPath(Mid(g_szXSL, 2))
End If
If (Application("fucked") <> "") Then
Set g_knex = Nothing
Else
Set g_knex = GetDatabaseConnection
End If
g_szHTML = TransformRSS(g_knex, g_szXSL)
' transforms
g_szHTML = Replace(g_szHTML, vbCrLf, " ")
g_szHTML = Replace(g_szHTML, "'", "\'")
%>
document.write('<%= g_szHTML %>');