附件防盗链-管理插件 V3.0

插件的主要功能:
1.全面兼容UBB和FCK编辑器
2.实现上传的附件防盗链功能(后台可以关闭此功能)
3.实现上传的图片添加水印的功能,后台有水印功能的相关设置
4.自带后台管理,可以对上传的附件信息进行修改
5.后台可以添加附件信息,可以实现对文件路径的隐藏功能
6.当用户下载附件时,可记录附件的下载次数以及显示附件的大小信息
7.整合wbc的附件清理功能,可在线删除上传的附件
8.可自行选择附件防盗链方式
……
附件管理插件 V3.0 For PJBlog2
1.修正了2.0中的BUG
2.增强了防盗链的性能
3.增加了文字防盗链方式,文字内容后台可以设置
4.新版本插件增加了对影音文件的防盗链
5.新增了附件类型的自动识别功能


安装方法共3步
第一步:用”Dreamweaver网页编辑器“打开 header.asp
找到
程序代码 程序代码
Dim BlogTitle


改成
程序代码 程序代码
response.cookies("shotan")= "ilankpj"
Session("shotan")="ilankpj"
Dim BlogTitle


注意:设置cookie时候,可以将这个值 ilankpj 改为其他的值,或者你可以用一个随机函数给他们赋值,不过一定要和download.asp中的 if Request.cookies("shotan")= "ilankpj" 一起修改,保证两值相同。

第二步:用”Dreamweaver网页编辑器“打开 common/ubbcode.asp
找到  
程序代码 程序代码
'-----------特殊标签----------------
                re.Pattern = "\[down=(.[^\]]*)\](.[^\[]*)\[\/down]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        tmpStr2=strMatch.SubMatches(1)
                        strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href="""&tmpStr1&""" target=""_blank"">"&tmpStr2&"</a>",1,-1,0)
                Next                
                
                re.Pattern = "\[down\](.[^\[]*)\[\/down]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href="""&tmpStr1&""" target=""_blank"">下载此文件</a>",1,-1,0)
                Next

                re.Pattern = "\[mDown=(.[^\]]*)\](.[^\[]*)\[\/mDown]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        tmpStr2=strMatch.SubMatches(1)
                        if len(memName)>0 then
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href="""&tmpStr1&""" target=""_blank"">"&tmpStr2&"</a>",1,-1,0)
                         else
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
                        end if
                Next

                re.Pattern = "\[mDown\](.[^\[]*)\[\/mDown]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        if len(memName)>0 then
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href="""&tmpStr1&""" target=""_blank"">下载此文件</a>",1,-1,0)
                         else
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
                        end if
                Next


替换成
程序代码 程序代码
'-----------特殊标签----------------
        re.Pattern = "\[down=(download\.asp\?id=)([0-9]*)\](.[^\[]*)\[\/down]"
        Set strMatchs=re.Execute(strContent)
        For Each strMatch in strMatchs
            tmpStr1=checkURL(strMatch.SubMatches(0))
            tmpStr2=strMatch.SubMatches(1)
                        tmpStr3=strMatch.SubMatches(2)
            strContent=Shotan_Download(strContent,strMatch.Value,tmpStr1,tmpStr2,tmpStr3)
        Next        
        
        re.Pattern = "\[down\](download\.asp\?id=)([0-9]*)\[\/down\]"
        Set strMatchs=re.Execute(strContent)
        For Each strMatch in strMatchs
            tmpStr1=checkURL(strMatch.SubMatches(0))
            tmpStr2=strMatch.SubMatches(1)
            strContent=Shotan_Download(strContent,strMatch.Value,tmpStr1,tmpStr2,"")
        Next

        re.Pattern = "\[mDown=(download\.asp\?id=)([0-9]*)\](.[^\[]*)\[\/mDown]"
        Set strMatchs=re.Execute(strContent)
        For Each strMatch in strMatchs
            tmpStr1=checkURL(strMatch.SubMatches(0))
            tmpStr2=strMatch.SubMatches(1)
                        tmpStr3=strMatch.SubMatches(2)
            if len(memName)>0 then
                strContent=Shotan_Download(strContent,strMatch.Value,tmpStr1,tmpStr2,tmpStr3)
             else
                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
            end if
        Next

        re.Pattern = "\[mDown\](download\.asp\?id=)([0-9]*)\[\/mDown]"
        Set strMatchs=re.Execute(strContent)
        For Each strMatch in strMatchs
            tmpStr1=checkURL(strMatch.SubMatches(0))
            if len(memName)>0 then
                strContent=Shotan_Download(strContent,strMatch.Value,tmpStr1,tmpStr2,"")
             else
                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
            end if
        Next


如果你的博客中用以前的方法添加的附件较多,你可以在上面的语句修改完之后,接着再加入
程序代码 程序代码

'=====================兼容以前的附件==================================
                re.Pattern = "\[down=attachments\/(.[^\]]*)\](.[^\[]*)\[\/down]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        tmpStr2=strMatch.SubMatches(1)
                        strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href=""attachments/"&tmpStr1&""" target=""_blank"">"&tmpStr2&"</a>",1,-1,0)
                Next                
                
                re.Pattern = "\[down\]attachments\/(.[^\[]*)\[\/down]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href=""attachments/"&tmpStr1&""" target=""_blank"">下载此文件</a>",1,-1,0)
                Next

                re.Pattern = "\[mDown=attachments\/(.[^\]]*)\](.[^\[]*)\[\/mDown]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        tmpStr2=strMatch.SubMatches(1)
                        if len(memName)>0 then
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href=""attachments/"&tmpStr1&""" target=""_blank"">"&tmpStr2&"</a>",1,-1,0)
                         else
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
                        end if
                Next

                re.Pattern = "\[mDown\]attachments\/(.[^\[]*)\[\/mDown]"
                Set strMatchs=re.Execute(strContent)
                For Each strMatch in strMatchs
                        tmpStr1=checkURL(strMatch.SubMatches(0))
                        if len(memName)>0 then
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""下载文件"" style=""margin:0px 2px -4px 0px""/> <a href=""attachments/"&tmpStr1&""" target=""_blank"">下载此文件</a>",1,-1,0)
                         else
                                strContent=replace(strContent,strMatch.Value,"<img src=""images/download.gif"" alt=""只允许会员下载"" style=""margin:0px 2px -4px 0px""/> 该文件只允许会员下载! <a href=""login.asp"">登录</a> | <a href=""register.asp"">注册</a>",1,-1,0)
                        end if
                Next
'=====================兼容以前的附件==================================


第三步:上传
1.将下载压缩包中的download.asp文件上传到网站的根目录下
2.将下载压缩包中的attachment.asp文件上传到网站的根目录下,覆盖原来的attachment.asp
3.将下载压缩包中的Attachment文件夹上传到自己博客的Plugins/文件夹下,然后进博客后台将插件安装一下

说明:如果不会修改或者从没有修改过博客源码,可以直接把 header.asp 与  common/ubbcode.asp 上传到博客目录覆盖。

注意:进行此操作前先做好文件备份,以便造成不必要的麻烦

下载:附件防盗链-管理插件 下载文件 下载此文件


[本日志由 ilank 于 2008-01-20 10:31 PM 编辑]
文章来自:
引用通告: 查看所有引用 | 我要引用此文章
Tags: pjblog 插件 防盗
相关文章:

评论: 14 | 引用: 0 | 查看次数: 52110
yangzhirong [2007-09-12 09:12 AM]
[quote=yangzhirong]我用了你的这个附件管理,很好.不过我有一个问题想请教一下,为什么下载次数一直为0呢?有的则不变了.谢谢!!

站长回复:请进博客后台,日志保存设置->静态日志模式->钩去掉,就行了[/quote]


谢谢指点,已经弄好了。
yangzhirong [2007-09-11 05:09 PM]
我用了你的这个附件管理,很好.不过我有一个问题想请教一下,为什么下载次数一直为0呢?有的则不变了.谢谢!!

站长回复:请进博客后台,日志保存设置->静态日志模式->钩去掉,就行了
pany [2007-08-12 11:38 PM]
2.7支持不?
StarFox [2007-05-16 02:50 PM]
忽然發現你鏈接了我的窩窩,呵呵,回去加你鏈接,你的博客好久沒來了

恩,喜歡,的

謝謝你在pj論壇上對我相冊的建議,可是你的相冊也是會被人下載的,我想隱藏,怎么做呢
发表评论
昵 称:
密 码: 游客发言不需要密码.
验证码: 验证码
内 容:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭