Spam reference prevention patches and automatic installation programs that send reference correction Patches

Source: Internet
Author: User

This is exactly the same. After the spam reference patch of PJBlog and the patch that failed to send new logs are released, I came to the door every day to ask about the modification error. To simplify the upgrade process and reduce the errors caused by the upgrade. After referring to some of my predecessors, I made the first two patches for automatic installation, code replacement, and Database Upgrade. Grace. Let's talk a little bit about it. For downloading, remember to back up the data before the upgrade, especially when backing up the database.

Although this program is successfully tested on the brand new PJBlog in my local environment, it cannot be ruled out that blogs installed with other plug-ins will not have problems. If an error occurs during your upgrade, please go to: http://www.myyu.net/2006/12/11/pjblog-anti-spam.html instructions. It mainly refers to whether the installation program prompts an installation error or an error after installation.

Because PJBlog static logs do not support data update, do not use static log mode. Unless you can generate a log file in the background diligently, in static log mode, the log is referenced, KEY Value update: the static log is not updated as the new KEY value, so that others cannot reference your old log.

Buy one get one, and teach you how to test it. Write a new log, and fill in the reference link of other logs in your blog in the reference box. If the message is sent successfully, it indicates that the patch referenced by the new log is successfully installed. If the reference is accepted successfully, the KEY of the referenced address is automatically replaced with the number (currently, only the dynamic log mode can be used automatically, static log mode because of the Mechanism problem, all log files must be re-generated in the background to be updated.) This indicates that the spam reference protection patch is successfully installed.

Appendix: manual installation tutorial address

Http://bbs.pjhome.net/viewthread.php? Tid = 9491 & extra = page % 3D1

Http://bbs.pjhome.net/viewthread.php? Tid = 9617 & extra = page % 3D6Copy codeThe Code is as follows: <! -- # Include file = "const. asp" -->
<! -- # Include file = "conn. asp" -->
<! -- # Include file = "common/function. asp" -->
<! -- # Include file = "common/library. asp" -->
<! -- # Include file = "common/cache. asp" -->
<! -- # Include file = "common/checkUser. asp" -->
<! -- # Include file = "class/cls_logAction.asp" -->
<! -- # Include file = "common/ubbcode. asp" -->
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml" lang = "UTF-8">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Meta http-equiv = "Content-Language" content = "UTF-8"/>
<Title> install a patch for PJBLOG spam reference to prevent plug-ins from failing to write new logs and send references </title>
</Head>
<Body>
<Div id = "main" style = "text-align: center">
Back up your database before upgrading. Click the following button to start the update.
<Div id = "button" style = "text-align: center">
<Form id = "form1" name = "form1" method = "post" action = "? Act = go ">
<Label>
<Input type = "submit" name = "Submit" value = "click to start updating! "/>
</Label>
</Form>
</Div>
<%
'On error resume next
If err then err. clear
Session. codepage = 65001
Private function LoadFile (ByVal File)
Dim cacheStream
Set cacheStream = Server. CreateObject ("ADODB. Stream ")
With cacheStream
. Type = 2
. Mode = 3
. Open
. Charset = "UTF-8"
. Position = cacheStream. Size
. LoadFromFile Server. MapPath (File)
LoadFile =. ReadText
. Close
End
End function

Private Function SaveFile (ByVal strBody, ByVal File)
Dim objStream
Dim RText
RText = ""
Set objStream = Server. CreateObject ("ADODB. Stream ")
If Err Then
RText = array (Err. Number, Err. Description)
Err. Clear
Exit function
End If
With objStream
. Type = 2
. Open
. Charset = "UTF-8"
. Position = objStream. Size
. WriteText = strBody
. SaveToFile Server. MapPath (File), 2
. Close
End
RText = "OK"
SaveFile = RText
Set objStream = Nothing
End Function

Private Function replaceStr (FileName, IntStr, FinStr)
Dim loadStr
LoadStr = LoadFile (FileName)
If instr (loadStr, IntStr) <> 0 then
SaveFile loadStr, FileName & "_ temp" 'backup!
LoadStr = replace (loadStr, IntStr, FinStr)
SaveFile loadStr, FileName
ReplaceStr = true
Else
ReplaceStr = false
End if
LoadStr = ""
End Function

Private Function DeleteFile (FilePath)
Dim FSO
Set FSO = Server. CreateObject ("Scripting. FileSystemObject ")
If fso. FileExists (server. mapPath (FilePath) Then
FSO. DeleteFile server. mapPath (FilePath), True
DeleteFile = True
Else
DeleteFile = false
End IF
Set FSO = Nothing
End Function

If request ("act") = "go" then
'===== Start ==================

Dim TempStr, result, aspOpen, aspClz, Er
Er = ""
Result = ""
AspOpen = chr (60) & chr (37)
AspClz = chr (37) & chr (62)

If Er = "" then
Result = replaceStr ("trackback. asp "," If Conn. execute ("" SELECT count (tb_ID) FROM blog_Trackback WHERE blog_ID = "" & tbID & "" AND tb_URL = '"& tbURL &"' AND tb_Title = '"" & tbTitle & ""' AND tb_Intro =' "" & tbExcerpt & "" 'AND tb_Site =' "" & tbBlog &""'"") (0)> 0 Then "," if StrComp (Request. queryString ("" key ""), blog_tbKey) = 0 Then "& vbcrlf &_
"" & Vbcrlf &_
"If Conn. execute ("" SELECT count (tb_ID) FROM blog_Trackback WHERE blog_ID = "" & tbID & "" AND tb_URL = '"& tbURL &"' AND tb_Title = '"" & tbTitle & ""' AND tb_Intro =' "" & tbExcerpt & "" 'AND tb_Site =' "" & tbBlog &""'"") (0)> 0 Then ")
If not result then Er = Er & "trackback. asp file modification First Step Error! <Br>"
End if

If Er = "" then
Result = replaceStr ("trackback. asp "," tbResponseXML 1, "" this reference announcement contains blocked characters "", "tbResponseXML 1, "" This reference announcement contains blocked characters "" & vbcrlf &_
"End if" & vbcrlf &_
"" & Vbcrlf &_
"Else" & vbcrlf &_
"TbResponseXML 1," "Hey! You have a wrong address! """)
If not result then Er = Er & "trackback. asp file modification step 2 error! <Br>"
End if

If Er = "" then
Result = replaceStr ("trackback. asp "," Conn. execute ("" UPDATE blog_Info Set blog_tbNums = blog_tbNums + 1 "") "," Conn. execute ("" UPDATE blog_Info Set blog_tbNums = blog_tbNums + 1 "") "& vbcrlf &_
"Dim tbKey" & vbcrlf &_
"RANDOMIZE" & vbcrlf &_
"TbKey = int (900000 * rnd) + 100000" & vbcrlf &_
"Conn. Execute (" "UPDATE blog_Info Set blog_tbKey =" "& tbKey )")
If not result then Er = Er & "trackback. asp file modification step 3 error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_logAction.asp", "SiteURL &" "trackback. asp? TbID = "" & LogID "," SiteURL & "" trackback. asp? TbID = "" & LogID & "& key =" "& blog_tbKey ")
If not result then Er = Er & "cls_logAction.asp file Step 1 Modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_logAction.asp", "Dim log_QuoteEvery, log_QuoteArr", "Dim log_QuoteEvery, log_QuoteArr, logid, LastID" & vbcrlf &_
"Set LastID = Conn. Execute (" select top 1 log_ID FROM blog_Content order by log_ID DESC "") "& vbcrlf &_
"Logid = LastID (" "log_ID "")")
If not result then Er = Er & "cls_logAction.asp file Step 2 modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_logAction.asp", "Trackback Trim (log_QuoteEvery), siteURL &" default. asp? Id = "" & logid, logTitle, CutStr (CheckStr (logIntro), 252), siteName "," Trackback Trim (log_QuoteEvery), siteURL & "default. asp? Id = "" & logid, logTitle, CutStr (CheckStr (logIntro), 252), siteName "& vbcrlf &_
"Set LastID = Nothing ")
If not result then Er = Er & "cls_logAction.asp file step 3 Modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("Template/Article. asp ", "<a href =" "<$ trackback $>" "target =" "_ blank" "> <$ trackback $> </a> <br/> ", "<span id = tburl> <a href =" "javascript: showTrackBack () ""> View reference addresses </a> </span> <br/> "& vbcrlf &_
"<Script type =" "text/javascript"> "& vbcrlf &_
"// Display the reference address" & vbcrlf &_
"Function showTrackBack () {" & vbcrlf &_
"Var tb_url_text" & vbcrlf &_
"Tb_url_text = '<a href =" "<$ trackback $>" "target =" "_ blank" "> <$ trackback $> </a>'" & vbcrlf & _
"Document. getElementById (" tburl ""). innerHTML = tb_url_text "& vbcrlf &_
"}" & Vbcrlf &_
"</Script> ")
If not result then Er = Er & "Article. asp file modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_article.asp", "% = (SiteURL &" "trackback. asp? TbID = "" & id) % "," (SiteURL & "" trackback. asp? TbID = "" & id )")
If not result then Er = Er & "cls_logAction.asp file Step 1 Modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_article.asp", "<a href =" "<(SiteURL &" "trackback. asp? TbID = "" & id)> "" target = "" _ blank ""> <(SiteURL & "trackback. asp? TbID = "" & id)> </a> <br/> "," <span id = tburl> <a href = "" javascript: showTrackBack () ""> View reference addresses </a> </span> <br/> "& vbcrlf &_
"<Script type =" "text/javascript"> "& vbcrlf &_
"// Display the reference address" & vbcrlf &_
"Function showTrackBack () {" & vbcrlf &_
"Var tb_url_text" & vbcrlf &_
"Tb_url_text = '<a href =" "<(SiteURL &" "trackback. asp? TbID = "" & id & "" & key = "" & blog_tbKey)> "" target = "" _ blank ""> <(SiteURL & "" trackback. asp? TbID = "" & id & "" & key = "" & blog_tbKey)> </a> <br/> '"& vbcrlf &_
"Document. getElementById (" tburl ""). innerHTML = tb_url_text "& vbcrlf &_
"}" & Vbcrlf &_
"</Script> ")
If not result then Er = Er & "cls_article.asp file Step 2 modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("class/cls_article.asp", "(SiteURL &" "trackback. asp? TbID = "" & id & "" & key = "" & blog_tbKey) "," % = (SiteURL & "" trackback. asp? TbID = "" & id & "& key =" "& blog_tbKey) % ")
If not result then Er = Er & "cls_logAction.asp file step 3 Modification error! <Br>"
End if

If Er = "" then
Conn. Execute ("alter table blog_Info ADD blog_tbKey INT ")
Conn. Execute ("UPDATE blog_Info Set blog_tbKey = 123456 ")
Else
Er = Er & "Database Upgrade failed. "
End if

If Er = "" then
Result = replaceStr ("common/cache. asp "," Dim publish, publish, blog_wapHTML, publish, publish, blog_wap, blog_wapURL "," Dim publish, publish, blog_wapHTML, publish, publish, blog_wap, publish, blog_tbKey ")
If not result then Er = Er & "cache. asp file first step modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("common/cache. asp "," blog_wapNum, numeric, blog_wapHTML, numeric, numeric, blog_wap, numeric "" & _ "," "blog_wapNum, numeric, blog_wapHTML, numeric, blog_wap, blog_wapURL, blog_tbKey ""&_")
If not result then Er = Er & "cache. asp file Step 2 modification error! <Br>"
End if

If Er = "" then
Result = replaceStr ("common/cache. asp "," blog_wapURL = CBool (blog_Infos () 'use wap to convert article hyperlinks "," blog_wapURL = CBool (blog_Infos )) 'Use wap to convert article hyperlinks '& vbcrlf &_
"Blog_tbKey = int (blog_Infos (45, 0) 'reference verification Key ")
If not result then Er = Er & "cache. asp file step 3 Modification error! <Br>"
End if

If Er <> "" then
Response. write Er & "<br> If the problem persists, leave a message <a href = 'HTTP: // www.alonefly.com/blog' target = '_ blank'> http://www.alonefly.com/blog </a>. "
Else
If not DeleteFile ("tbspam_update.asp") then
Response. write "Please manually delete the tbspam_update.asp file! <Br>"
Else
The response. write "tbspam_update.asp file has been automatically deleted! <Br>"
End if
Response. write "updated! <Br> All update files have been backed up! Name: original file name _ temp! "
End if
End if

If err <> 0 then
Response. Write err & Err. Description & Err. Source
End if
%>
</Div>
</Body>
</Html>

Download this file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.