發 布 人: 向導
補 丁 名: 垃圾引用防御補丁
發布時間: 2007-1-4
版 本 號: 第3版
適用版本: PJblog 2.6
原 作 者: 向導
演示地址: http://www.hljsh.com/
下載地址: http://bbs.pjhome.net/attachment.php?aid=2143
插件簡介: 能有效防止垃圾引用。加密遞交地址,第2版增加KEY驗證,並每小時自動更換一次key。
本版本不修改數據庫,只修改了4個文件,並支持靜態頁模式!
效果
引用通告地址: trackback.asp?tbID=JNKRQOF8&key=JOKNPNKOQPMPPMC0
具體安裝方法如下:
===========================================================
文件trackback.asp
查找
tbID = CheckStr(Request.QueryString("tbID"))
替換成
tbID = Decrypt(CheckStr(Request.QueryString("tbID")))
查找
If Not (IsInteger(Request.QueryString("tbID")) AND IsInteger(Request.QueryString("logID"))) Then
替換成
If Not IsInteger(Decrypt(Request.QueryString("tbID"))) AND IsInteger(Request.QueryString("logID")) Then
查找
Where blog_ID="&logID&" AND tb_ID="&CheckStr(Request.QueryString("tbID"))
替換成
Where blog_ID="&logID&" AND tb_ID="&Decrypt(CheckStr(Request.QueryString("tbID")))
**有2處
查找
'==================================
' 引用通告處理頁面
' 更新時間: 2006-6-1
'==================================
在下面加入
dim keys,keys1
keys=Request.QueryString("key")
keys1=Encrypt((year(now))&(Month(now))&(day(now))&hour(now()))
if keys<>keys1 then
Response.c
Response.write "<?xml version=""1.0"" encoding=""UTF-8""?><?xml-stylesheet type=""text/xsl"" href=""tb.xsl""?>"
%>
<response><error>1</error><message>您遞交的信息已過期.請檢查...</message></response>
<%
else
dim strget
strget=trim(Request.QueryString("tbID"))
if len(strget) > 8 then
Response.c
Response.write "<?xml version=""1.0"" encoding=""UTF-8""?><?xml-stylesheet type=""text/xsl"" href=""tb.xsl""?>"
%>
<response><error>1</error><message>您遞交的信息有錯誤.請檢查...</message></response>
<%
else
dim tbIDs
tbIDs = Decrypt(CheckStr(Request.QueryString("tbID")))
if tbIDs < 1 then
Response.c
Response.write "<?xml version=""1.0"" encoding=""UTF-8""?><?xml-stylesheet type=""text/xsl"" href=""tb.xsl""?>"
%>
<response><error>1</error><message>您遞交的信息有錯誤.請檢查...</message></response>
<%
else
查找
'Trackback response function上面加入
end if
end if
end if
********可以不換***********
查找
Response.Redirect("search.asp?searchType=trackback")
替換成
Response.c
Response.write "<?xml version=""1.0"" encoding=""UTF-8""?><?xml-stylesheet type=""text/xsl"" href=""tb.xsl""?>"
%>
<response><error>1</error><message>日志ID錯誤.請檢查......</message></response>
<%
查找
<response><error>1</error><message>日志沒有被引用.</message></response>
替換成
<response><error>1</error><message>日志(ID=<% Response.write tbID %>)沒有被引用.</message></response>
********可以不換***********
===========================================================
文件class\cls_article.asp
查找
引用通告地址:<a href="<%=(SiteURL&"trackback.asp?tbID="&id)%>" target="_blank"><%=(SiteURL&"trackback.asp?tbID="&id)%></a>
替換成
引用通告地址:<a href="<%=(SiteURL&"trackback.asp?tbID="&Encrypt(id)&"&key="&Encrypt((year(now))&(Month(now))&(day(now))&hour(now())))%>" target="_blank"><%=(SiteURL&"trackback.asp?tbID="&Encrypt(id)&"&key="&Encrypt((year(now))&(Month(now))&(day(now))&hour(now())))%></a>
查找
Sub ShowComm(LogID,comDesc,DisComment)
在下面添加
dim k1
k1=Encrypt((year(now))&(Month(now))&(day(now))&hour(now()))
查找
href=""trackback.asp?action=deltb&tbID="&commArr(6,Pcount)&"&logID="&LogID&"""
替換成
href=""trackback.asp?action=deltb&tbID="&Encrypt(commArr(6,Pcount))&"&logID="&LogID&"&key="&k1&"""
查找
TempArticle=Replace(TempArticle,"<"&"%ST(A)%"&">","")
替換成
dim k1
k1=Encrypt((year(now))&(Month(now))&(day(now))&hour(now()))
TempArticle=Replace(TempArticle,"<"&"%ST(A)%"&">","")
TempArticle=Replace(TempArticle,"<"&"%ST(KEY)%"&">",k1)===========================================================
文件class\cls_logAction.asp
查找
Temp1=Replace(Temp1,"<$trackback$>",SiteURL&"trackback.asp?tbID="&LogID)
替換成
Temp1=Replace(Temp1,"<$trackback$>",SiteURL&"trackback.asp?tbID="&Encrypt(LogID)&"&key="&"<"&"%ST(KEY)%"&">")===========================================================
文件common\function.asp
在文件最後,%>的上面添加
Function Encrypt(theNumber)
On Error Resume Next
Dim n, szEnc, t, HiN, LoN, i
n = CDbl((theNumber + 1570) ^ 2 - 7 * (theNumber + 1570) - 450)
If n < 0 Then szEnc = "R" Else szEnc = "J"
n = CStr(abs(n))
For i = 1 To Len(n) step 2
t = Mid(n, i, 2)
If Len(t) = 1 Then
szEnc = szEnc & t
Exit For
End If
HiN = (CInt(t) And 240) / 16
LoN = CInt(t) And 15
szEnc = szEnc & Chr(Asc("M") + HiN) & Chr(Asc("C") + LoN)
Next
Encrypt = szEnc
End Function
Function Decrypt(theNumber)
On Error Resume Next
Dim e, n, sign, t, HiN, LoN, NewN, i
e = theNumber
If Left(e, 1) = "R" Then sign = -1 Else sign = 1
e = Mid(e, 2)
NewN = ""
For i = 1 To Len(e) step 2
t = Mid(e, i, 2)
If Asc(t) >= Asc("0") And Asc(t) <= Asc("9") Then
NewN = NewN & t
Exit For
End If
HiN = Mid(t, 1, 1)
LoN = Mid(t, 2, 1)
HiN = (Asc(HiN) - Asc("M")) * 16
LoN = Asc(LoN) - Asc("C")
t = CStr(HiN or LoN)
If Len(t) = 1 Then t = "0" & t
NewN = NewN & t
Next
e = CDbl(NewN) * sign
Decrypt = CLng((7 + sqr(49 - 4 * (-450 - e))) / 2 - 1570)
End Function
================================================
演示到我的BLOG看。我網絡很慢。請您忍耐。
沒有修改過這4個文件的用戶可以下載下面的覆蓋即可。
================================================
使用靜態頁的需要到後台從新建立所有日記。
不知道還有那不對的。希望大家踴躍測試,拍磚。
點擊下載此文件