当前位置: 移动技术网 > IT编程>开发语言>Asp > 垃圾引用防治补丁以及发送引用修正补丁的自动安装程序

垃圾引用防治补丁以及发送引用修正补丁的自动安装程序

2017年12月12日  | 移动技术网IT编程  | 我要评论
实在没辙, 的垃圾引用防治补丁以及新日志发送失败的修正补丁发布后,天天都有因为修改错误而找上门询问的。为了简化大家的升级步骤,减少升级造成的错误。本人参考了部分前辈的程序后,做出了前面两个补丁的自动安装程序,代码替换,数据库升级都一步到位。恩恩。废话少讲,给下载,大家记得升级前要备份哈,尤其是数据库一定要备份一次。

  虽然本程序在本人的本地环境里的全新  上测试成功,但不能排除装过其他插件的博客不会出现问题。如果您升级出现了差错请到: 说明一下。主要是说下安装程序是否有提示安装出错,或者安装完后的出错情况。

  由于  的静态日志不具备数据更新的能力,所以请不要使用静态日志模式。除非你能勤快的到后台重新生成日志文件,否则在静态日志模式下,会因为日志被引用,key 值更新可静态日志没更新为新key 值而造成别人无法引用的你旧日志。

  买一送一,教大家测试下哈。写个新日志,引用框里填上自己博客内的其他日志的引用链接。如果发送成功说明新日志发送引用的补丁安装成功、如果接受引用成功,同时引用地址的key自动更换了数字(目前只有动态日志模式可以自动,静态日志模式由于机制问题必须到后台重新生成所有日志文件才能更新),说明垃圾引用防治补丁安装成功。

附:手动安装的教程地址 

&extra=page%3d1

&extra=page%3d6
复制代码 代码如下:

<!--#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>安装 pjblog 垃圾引用防止插件以及写新日志发送引用失败的修正补丁</title>
</head>
<body>
<div id="main" style="text-align:center">
请升级前,备份好你的数据库。然后点击下面的按钮开始更新。
<div id="button" style="text-align:center">
<form id="form1" name="form1" method="post" action="?act=go">
  <label>
  <input type="submit" name="submit" value="点击开始更新!" />
  </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 with  
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 with
    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 文件修改第一步出错!<br>"
    end if

    if er="" then
       result=replacestr("trackback.asp","            tbresponsexml 1,""此引用通告中包含被屏蔽的字符""","            tbresponsexml 1,""此引用通告中包含被屏蔽的字符"""&vbcrlf&_
"   end if"&vbcrlf&_
""&vbcrlf&_
"else"&vbcrlf&_
"            tbresponsexml 1,""嘿!你小子搞错地址了吧!""")
       if not result then er=er&"trackback.asp 文件修改第二步出错!<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 文件修改第三步出错!<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 文件第一步修改出错!<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 文件第二步修改出错!<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 文件第三步修改出错!<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()"">查看引用地址</a></span><br/>"&vbcrlf&_
"<script type=""text/javascript"">"&vbcrlf&_
"// 引用地址显示"&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 文件修改出错!<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 文件第一步修改出错!<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()"">查看引用地址</a></span><br/>"&vbcrlf&_
"<script type=""text/javascript"">"&vbcrlf&_
"// 引用地址显示"&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 文件第二步修改出错!<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 文件第三步修改出错!<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&"数据库升级失败。"
    end if

    if er="" then
       result=replacestr("common/cache.asp","dim blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl","dim blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl,blog_tbkey")
       if not result then er=er&"cache.asp 文件第一步修改出错!<br>"
    end if

    if er="" then
       result=replacestr("common/cache.asp","""blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl"" & _","""blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl,blog_tbkey"" & _")
       if not result then er=er&"cache.asp 文件第二步修改出错!<br>"
    end if

    if er="" then
       result=replacestr("common/cache.asp","blog_wapurl=cbool(blog_infos(44,0))'使用 wap 转换文章超链接","blog_wapurl=cbool(blog_infos(44,0))'使用 wap 转换文章超链接"&vbcrlf&_
"       blog_tbkey=int(blog_infos(45,0))'引用验证key")
       if not result then er=er&"cache.asp 文件第三步修改出错!<br>"
    end if

    if er<>"" then
       response.write er&"<br>如果未能解决请到<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 "请手动删除 tbspam_update.asp 文件!<br>"
        else
          response.write "tbspam_update.asp 文件已经自动删除!<br>"
       end if
       response.write "更新完成!<br>所有更新文件已经备份!名为: 原文件名_temp !"
    end if
end if

if err<>0 then
   response.write err & err.description & err.source
end if
%>
</div>
</body>
</html>


下载文件

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网