*********************************************************
' 目的:随机日志显示 by 七夜 2005.11.22
'*********************************************************
Function BlogReBuild_rnd()
Dim i
Dim s
Dim objRS
Dim objStream
Dim objArticle
'rnd
Dim strPrevious
Dim cc_w_view_i,cc_w_view_j,cc_w_view_sql
'生成随机取文章SQL
Randomize
cc_w_view_j = Int(Rnd*15+1)
cc_w_view_sql = "log_ID"
For cc_w_view_i = 1 To cc_w_view_j
cc_w_view_sql = "Rnd(" & cc_w_view_sql & ")"
Next
Set objRS=objConn.Execute("SELECT [log_ID],[log_title] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>2) ORDER BY " & cc_w_view_sql & " DESC")
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to ZC_PREVIOUS_COUNT
Set objArticle=New TArticle
If objArticle.LoadInfoByID(objRS("log_ID")) Then
strPrevious=strPrevious & "<li><a href="""& objArticle.Url & """ title=""" & objArticle.Title & """>" & objArticle.Title & "</a></li>"
End If
Set objArticle=Nothing
objRS.MoveNext
If objRS.eof Then Exit For
Next
End If
objRS.close
strPrevious=TransferHTML(strPrevious,"[no-asp]")
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Type = adTypeText
.Mode = adModeReadWrite
.Open
.Charset = "utf-8"
.Position = objStream.Size
.WriteText = strPrevious
.SaveToFile BlogPath & "/include/rnd.asp",adSaveCreateOverWrite
.Close
End With
Set objStream = Nothing
If strPrevious<>"" And ZC_STATIC_TYPE="shtml" Then
Call RemoveBOM("rnd.asp")
End if
BlogReBuild_rnd=True
End Function
今天是没时间改了,只能拖后了。
在七夜的博客中又同时看到了以下代码,对我这个blog程序应该也有用,至少有参考保价值。先收下了。
添加了BanIP代码修改方法:
打开 c_system_event.asp
在 Function PostComment() 下面,加上
Dim SRegExp,Matches
Set SRegExp=New RegExp
SRegExp.IgnoreCase =True
SRegExp.Global=True
SRegExp.Pattern="http"
Set Matches = SRegExp.Execute(Request.Form("inpArticle"))
If Matches.count>=2 then
Set SRegExp=Nothing
Response.Write "Sorry,you can only input one link"
If isempty(Session("SipoBanIP")) then
Session("SipoBanIP")=1
Else
Session("BanIP")=2
End If
Response.End
End If
Set SRegExp=Nothing
If not isempty(Session("SipoBanIP")) and Session("SipoBanIP")=2 then
Response.Write "Sorry,Your IP is Baned By Our Site."
Response.End
End IF
解释:
如果有人在评论中发布了2个以上的链接,则禁止发布评论,如果仍然发布,则简单Ban掉这个人。
来源:sipo
If not isempty(Session("postBanIP")) and Session("postBanIP")=2 and memStatus<>"SupAdmin" then
msg_Title="出现错误"
msg_Content="<a href=""javascript:history.go(-1);"">对不起,您的IP已经被本站屏蔽,已被禁止发表评论!</a>"
Response.End
End IF
Dim SRegExp,Matches
Set SRegExp=New RegExp
SRegExp.IgnoreCase =True
SRegExp.Global=True
SRegExp.Pattern="http://"
Set Matches = SRegExp.Execute(Request.Form("message"))
If Matches.count>=2 and Request.Form("comm_AutoURL")=1 then
Set SRegExp=Nothing
msg_Title="出现错误"
msg_Content="<a href=""javascript:history.go(-1);"">对不起,识别链接状态下您只能输入一个链接!</a>"
If isempty(Session("postBanIP")) then
Session("postBanIP")=1
Else
Session("postBanIP")=2
End If
Response.End
End If对David的Referer做了一点修改,增加了雅虎、QQ等搜索引擎关键字的显示,原版只显示Google及百度的关键字,3721的好像有点问题。具体效果看参照我首页的Referer
修改inc.asp,版本为最新的1006版
function getRefName(refUrl)部分,整体替换
function getRefName(refUrl){
var googleSeRE = new RegExp("^http://www.google.com.*q=([^&]*).*");
var baiduSeRE = new RegExp("^http://www.baidu.com.*wd=([^&]*).*");
var sogouSeRE = new RegExp("^http://www.sogou.com.*query=([^&]*).*");
var wangyiSeRE = new RegExp("^http://cha.so.163.com.*q=([^&]*).*");
var qqqqSeRE = new RegExp("^http://so.qq.com.*w=([^&]*).*");
var yahooSeRE = new RegExp("^http://www.yahoo.com.cn.*p=([^&]*).*");
var seekSeRE = new RegExp("^http://seek.3721.com.*p=([^&]*).*");
var otherRE = new RegExp("^http://([^/]*).*");
var refName = "";
if(refUrl.indexOf("http://www.google.com") != -1) {
if(googleSeRE.test(refUrl)){
try{
refName = ("google:" + escape(decodeURI(refUrl.replace(googleSeRE,"$1")))).substring(0,255);
}catch(exception){
refName = "google"
}
}else{
refName = "google";
}
}else if(refUrl.indexOf("http://www.yahoo.com.cn") != -1) {
if(yahooSeRE.test(refUrl)){
try{
refName = ("yahoo:" + escape(decodeURI(refUrl.replace(yahooSeRE,"$1")))).substring(0,255);
}catch(exception){
refName = "yahoo"
}
}else{
refName = "yahoo";
}
}else if(refUrl.indexOf("http://seek.3721.com") != -1) {
if(seekSeRE.test(refUrl)){
try{
refName = ("3721:" + escape(decodeURI(refUrl.replace(seekSeRE,"$1")))).substring(0,255);
}catch(exception){
refName = "3721"
}
}else{
refName = "3721";
}
}else if(refUrl.indexOf("http://www.baidu.com") != -1) {
if(baiduSeRE.test(refUrl)){
try{
refName = ("baidu:" + gb2utf(refUrl.replace(baiduSeRE,"$1"))).substring(0,255);
}catch(exception){
refName = "baidu"
}
}else{
refName = "baidu";
}
}else if(refUrl.indexOf("http://www.sogou.com") != -1) {
if(sogouSeRE.test(refUrl)){
try{
refName = ("sogou:" + gb2utf(refUrl.replace(sogouSeRE,"$1"))).substring(0,255);
}catch(exception){
refName = "sogou"
}
}else{
refName = "sogou";
}
}else if(refUrl.indexOf("http://so.qq.com") != -1) {
if(qqqqSeRE.test(refUrl)){
try{
refName = ("QQ:" + gb2utf(refUrl.replace(qqqqSeRE,"$1"))).substring(0,255);
}catch(exception){
refName = "QQ"
}
}else{
refName = "QQ";
}
}else if(refUrl.indexOf("http://cha.so.163.com") != -1) {
if(wangyiSeRE.test(refUrl)){
try{
refName = ("163:" + gb2utf(refUrl.replace(wangyiSeRE,"$1"))).substring(0,255);
}catch(exception){
refName = "163"
}
}else{
refName = "163";
}
}else{
try{
refName = escape(refUrl.replace(otherRE,"$1")).substring(0,255);
}catch(exception){
refName = "other"
}
}
return refName;
}
另外,关键字超长折行的解决办法,observer.asp 177行修改成如下样子,红色部分为新加的,41为显示字符的长度,由于某些原因,长度与实际的不符,而且可能产生半个字符的现象,请根据需要自行调试长度
showScript += " showStr += ' - <a href = \"' + refArray[i] + '\" title=\"' + refArray[i] + '\" target=\"_blank\">' + unescape(nameArray[i].slice(0,41)) + '</a>';\n";
以下引自 浪人黑白最近一直在留言本那边出现垃圾留言,很多人为了获得指向自己网站的导入链接,因而大量在流量大的网站的留言板、BBS发贴,这对于搜索引擎来说属于垃圾链接。如果站主不限制限制,搜索引擎就会去索引那些链接。当然对于你的网站流量会大些,但是出现的都是那些不堪入目的信息,你愿意么?
垃圾留言(Comment Spam),对于Blogger而言,实在是大敌。介绍2个方法吧!
首先,确认码(Security Code)是一种行之有效的防范方式——采用图像方式显示确认码(Security Code),系统通过判断留言者输入的确认码正确与否来认定留言者是真实的人还是机器人——这种方式不会出现判断失误的情况。通过程序将无法大量散发垃圾留言,因为采用人工智能来识别确认码的成本极高,垃圾留言者肯定无法做到。
其次,使用NoFollow标签来对抗垃圾留言,这其实是Google开发的成果,Google利用一种新型标签淘汰垃圾评论链接,使用该属性,网站主可以限制搜索引擎跟踪某一链接。在链接标签中显示为:rel="nofollow"。这样做的目的,是为了阻止搜索引擎去搜索那些博客站上垃圾性的、不想被索引的评论。如果超链接有NoFollow的属性,Google在对搜索结果进行网站排列时,这些链接不会算入。对于blog程序来说,只要将comments里出现的所有链接自动加上 rel = “nofollow” 的属性就可以实现了。
[CODE_LITE]
DIM MaxUrl,MaxHttp
MaxUrl=2 '最多可以在一个评论中加多少个[url ]
MaxHttp=3 '最多可以在一个评论中加多少个 http://
ElseIF Strurls(Request.Form("message"),"[url")>MaxUrl or Strurls(Request.Form("message"),"http://")>MaxHttp then
msg_Title="出现错误"
msg_Content="<a href='javascript:history.go(-1);'>您输入的内容有太多链接。这是不允许的!点击返回上一页</a>"
ElseIF Strurls(Request.Form("message"),"[url")>MaxUrl or Strurls(Request.Form("message"),"http://")>MaxHttp then
msg_Title="出现错误"
msg_Content="<a href='javascript:history.go(-1);'>您输入的内容有太多链接。这是不允许的!点击返回上一页</a>"

