评论留言加上邮箱和网址
作者:小戒 日期:2007-12-08
发布网站:www.muzili.com
类型:本站原创
1.下载压缩包,解压后上传至PJBLOG所在目录,执行升级数据库.
2.打开class下的cls_article.asp,找到
复制内容到剪贴板
程序代码
程序代码 SQL="Select comm_ID,comm_Content,comm_Author,comm_PostTime,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY FROM blog_Comment Where blog_ID="&LogID&" UNION ALL Select 0,tb_Intro,tb_Title,tb_PostTime,tb_URL,tb_Site,tb_ID,0,'127.0.0.1',0 FROM blog_Trackback Where blog_ID="&LogID&" orDER BY comm_PostTime "&comDesc
修改为:
复制内容到剪贴板
程序代码
程序代码 SQL="Select comm_ID,comm_Content,comm_Author,comm_PostTime,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY,email,siteurl FROM blog_Comment Where blog_ID="&LogID&" UNION ALL Select 0,tb_Intro,tb_Title,tb_PostTime,tb_URL,tb_Site,tb_ID,0,'127.0.0.1',0,0,0 FROM blog_Trackback Where blog_ID="&LogID&" orDER BY comm_PostTime "&comDesc
找到
复制内容到剪贴板
程序代码
程序代码<%=blog_CommAuthor%></strong></a> <span class="commentinfo">
复制内容到剪贴板
程序代码
程序代码<%
if trim(commArr(10,Pcount))<>"" then
response.write " <a href=mailto:"&trim(commArr(10,Pcount))&" target=_blank><img src=images/email1.gif border=0></a>"
else
response.write " <img src=images/noemail1.gif>"
end if
if trim(commArr(11,Pcount))<>"" and trim(commArr(11,Pcount))<>"http://" then
response.write " <a href="&trim(commArr(11,Pcount))&" target=_blank><img src=images/url1.gif border=0></a>"
else
response.write " <img src=images/nourl1.gif>"
end if
%>
if trim(commArr(10,Pcount))<>"" then
response.write " <a href=mailto:"&trim(commArr(10,Pcount))&" target=_blank><img src=images/email1.gif border=0></a>"
else
response.write " <img src=images/noemail1.gif>"
end if
if trim(commArr(11,Pcount))<>"" and trim(commArr(11,Pcount))<>"http://" then
response.write " <a href="&trim(commArr(11,Pcount))&" target=_blank><img src=images/url1.gif border=0></a>"
else
response.write " <img src=images/nourl1.gif>"
end if
%>
找到
复制内容到剪贴板
程序代码
程序代码 <%if memName=empty or blog_validate=true then%><tr><td align="right" width="70"><strong>验证码:</strong></td><td align="left" style="padding:3px;"><input name="validate" type="text" size="4" class="userpass" maxlength="4"/> <%=getcode()%></td></tr><%end if%>
在其上插入一行,加入以下代码
复制内容到剪贴板
程序代码
程序代码 <%if memName=empty then%><tr><td align="right" width="70"><strong>邮 箱:</strong></td><td align="left" style="padding:3px;"><input name="myblogemail" type="text" size="18" class="userpass" maxlength="24"/> 请填写您的邮箱.</td></tr><%end if%>
<%if memName=empty then%><tr><td align="right" width="70"><strong>网 址:</strong></td><td align="left" style="padding:3px;"><input name="myblogsiteurl" type="text" class="userpass" value="http://" size="18" maxlength="24"/> 请填写您的网址.</td></tr><%end if%>
<%if memName=empty then%><tr><td align="right" width="70"><strong>网 址:</strong></td><td align="left" style="padding:3px;"><input name="myblogsiteurl" type="text" class="userpass" value="http://" size="18" maxlength="24"/> 请填写您的网址.</td></tr><%end if%>
3.打开PJBLOG根目录下的blogcomm.asp,找到
复制内容到剪贴板
程序代码
程序代码 password=trim(CheckStr(request.form("myblogpassword")))
在其下插入如下代码
复制内容到剪贴板
程序代码
程序代码 dim email,siteurl
email=trim(CheckStr(request.form("myblogemail")))
siteurl=trim(CheckStr(request.form("myblogsiteurl")))
email=trim(CheckStr(request.form("myblogemail")))
siteurl=trim(CheckStr(request.form("myblogsiteurl")))
找到
复制内容到剪贴板
程序代码
程序代码 IF (memName=empty or blog_validate=true) and cstr(lcase(Session("GetCode")))<>cstr(lcase(validate)) then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>验证码有误,请返回重新输入</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>验证码有误,请返回重新输入</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
在其上插入如下代码
复制内容到剪贴板
程序代码
程序代码 if memName=empty and email<>"" and IsValidEmail(email)=false then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>邮箱格式错误</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
if memName=empty and siteurl<>"" and siteurl<>"http://" and IsRightUrl(siteurl)=false then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>网址格式错误</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>邮箱格式错误</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
if memName=empty and siteurl<>"" and siteurl<>"http://" and IsRightUrl(siteurl)=false then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>网址格式错误</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
找到
复制内容到剪贴板
程序代码
程序代码 AddComm=array(array("blog_ID",post_logID),array("comm_Content",post_Message),array("comm_Author",username),array("comm_DisSM",post_DisSM),array("comm_DisUBB",post_DisUBB),array("comm_DisIMG",post_disImg),array("comm_AutoURL",post_DisURL),Array("comm_PostIP",getIP),Array("comm_AutoKEY",post_DisKEY))
修改为:
复制内容到剪贴板
程序代码
程序代码 AddComm=array(array("blog_ID",post_logID),array("comm_Content",post_Message),array("comm_Author",username),array("comm_DisSM",post_DisSM),array("comm_DisUBB",post_DisUBB),array("comm_DisIMG",post_disImg),array("comm_AutoURL",post_DisURL),Array("comm_PostIP",getIP),Array("comm_AutoKEY",post_DisKEY),Array("email",email),Array("siteurl",siteurl))
打开common下的function.asp,在最后一个
复制内容到剪贴板
程序代码
程序代码%>
复制内容到剪贴板
程序代码
程序代码Function IsRightUrl(UrlStrng) '网址判断
Dim regEx, retVal
Set regEx = New RegExp
regEx.Pattern = "^https?:\/\/[\u4E00-\u9FA5a-zA-Z\.\/0-9]{3,}[\u4E00-\u9FA5a-zA-Z\/0-9]{2,}$"
regEx.IgnoreCase = False
retVal = regEx.Test(UrlStrng)
If retVal Then
IsRightUrl = true
Else
IsRightUrl = false
End If
End Function
Public function IsValidEmail(email) '邮箱判断
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
Dim regEx, retVal
Set regEx = New RegExp
regEx.Pattern = "^https?:\/\/[\u4E00-\u9FA5a-zA-Z\.\/0-9]{3,}[\u4E00-\u9FA5a-zA-Z\/0-9]{2,}$"
regEx.IgnoreCase = False
retVal = regEx.Test(UrlStrng)
If retVal Then
IsRightUrl = true
Else
IsRightUrl = false
End If
End Function
Public function IsValidEmail(email) '邮箱判断
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
以下第4和第5点只针对留言插件.
4.打开Plugins/GuestBook/bookaction.asp,找到
复制内容到剪贴板
程序代码
程序代码 post_Message=request.form("Message")
复制内容到剪贴板
程序代码
程序代码 dim email,siteurl
email=trim(CheckStr(request.form("myblogemail")))
siteurl=trim(CheckStr(request.form("myblogsiteurl")))
email=trim(CheckStr(request.form("myblogemail")))
siteurl=trim(CheckStr(request.form("myblogsiteurl")))
找到
复制内容到剪贴板
程序代码
程序代码 if filterSpam(post_Message,"../../spam.xml") and stat_Admin=0 then
showmsg "留言发表错误信息","<b>留言中包含被屏蔽的字符</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
showmsg "留言发表错误信息","<b>留言中包含被屏蔽的字符</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
在其上插入一行,加以下代码
复制内容到剪贴板
程序代码
程序代码 if memName=empty and email<>"" and IsValidEmail(email)=false then
showmsg "留言发表错误信息","<b>邮箱格式错误</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
if memName=empty and siteurl<>"" and siteurl<>"http://" and IsRightUrl(siteurl)=false then
showmsg "留言发表错误信息","<b>网址格式错误</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
showmsg "留言发表错误信息","<b>邮箱格式错误</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
if memName=empty and siteurl<>"" and siteurl<>"http://" and IsRightUrl(siteurl)=false then
showmsg "留言发表错误信息","<b>网址格式错误</b><br/><a href=""javascript:history.go(-1);"">返回</a>","WarningIcon","plugins"
exit function
end if
找到
复制内容到剪贴板
程序代码
程序代码 Conn.ExeCute("Insert INTO blog_book(book_Messager,book_face,book_IP,book_Content,book_HiddenReply,email,siteurl) VALUES ('"&username&"','"&face&"','"&getIP()&"','"&post_Message&"',"&hiddenreply&")")
修改为:
复制内容到剪贴板
程序代码
程序代码 Conn.ExeCute("Insert INTO blog_book(book_Messager,book_face,book_IP,book_Content,book_HiddenReply,email,siteurl) VALUES ('"&username&"','"&face&"','"&getIP()&"','"&post_Message&"',"&hiddenreply&",'"&email&"','"&siteurl&"')")
5.打开Plugins/GuestBook/guestbook.asp,找到
复制内容到剪贴板
程序代码
程序代码 <a href="member.asp?action=view&memName=<%=Server.URLEncode(GuestDB("book_Messager"))%>"><b><%=GuestDB("book_Messager")%></b></a> <span class="commentinfo">
复制内容到剪贴板
程序代码
程序代码<%
if trim(GuestDB("email"))<>"" then
response.write " <a href=mailto:"&trim(GuestDB("email"))&" target=_blank><img src=images/email1.gif border=0></a>"
else
response.write " <img src=images/noemail1.gif>"
end if
if trim(GuestDB("siteurl"))<>"" and trim(GuestDB("siteurl"))<>"http://" then
response.write " <a href="&trim(GuestDB("siteurl"))&" target=_blank><img src=images/url1.gif border=0></a>"
else
response.write " <img src=images/nourl1.gif>"
end if
%>
if trim(GuestDB("email"))<>"" then
response.write " <a href=mailto:"&trim(GuestDB("email"))&" target=_blank><img src=images/email1.gif border=0></a>"
else
response.write " <img src=images/noemail1.gif>"
end if
if trim(GuestDB("siteurl"))<>"" and trim(GuestDB("siteurl"))<>"http://" then
response.write " <a href="&trim(GuestDB("siteurl"))&" target=_blank><img src=images/url1.gif border=0></a>"
else
response.write " <img src=images/nourl1.gif>"
end if
%>
找到
复制内容到剪贴板
程序代码
程序代码 <tr><td align="right" width="70"><strong>验证码:</strong></td><td align="left" style="padding:3px;"><input name="validate" type="text" size="4" class="userpass" maxlength="4"/> <%=getcode()%></td></tr>
在上面插入以下代码
复制内容到剪贴板
程序代码
程序代码 <%if memName=empty then%><tr><td align="right" width="70"><strong>邮 箱:</strong></td><td align="left" style="padding:3px;"><input name="myblogemail" type="text" size="18" class="userpass" maxlength="24"/> 请填写您的邮箱.</td></tr><%end if%>
<%if memName=empty then%><tr><td align="right" width="70"><strong>网 址:</strong></td><td align="left" style="padding:3px;"><input name="myblogsiteurl" type="text" class="userpass" value="http://" size="18" maxlength="24"/> 请填写您的网址.</td></tr><%end if%>
<%if memName=empty then%><tr><td align="right" width="70"><strong>网 址:</strong></td><td align="left" style="padding:3px;"><input name="myblogsiteurl" type="text" class="userpass" value="http://" size="18" maxlength="24"/> 请填写您的网址.</td></tr><%end if%>
此默认为EMAIL和网址为选填,如果要为必填,请将上面的
复制内容到剪贴板
程序代码
程序代码if memName=empty and email<>"" and IsValidEmail(email)=false then
复制内容到剪贴板
程序代码
程序代码if memName=empty and IsValidEmail(email)=false then
复制内容到剪贴板
程序代码
程序代码if memName=empty and siteurl<>"" and siteurl<>"http://" and IsRightUrl(siteurl)=false then
复制内容到剪贴板
程序代码
程序代码if memName=empty and IsRightUrl(siteurl)=false then
点击下载附件OK,全文结束.
评论: 0 | 引用: 0 | 查看次数: -
回复
[2008-11-14 02:57 PM |
]谢谢,我想加上QQ怎么改
我试下看看!
你这个方法修改是必填吗?评论会出错。
Server ?ԏont> ?펳 'ASP 0178 : 80070005'
Server.CreateObject ?Îʴ펳
/common/function.asp??А 8
?첩ȨϞʱ???ԠServer.CreateObject ?ĵ???ܡ??ܾ??ԏÎʡ?
Server ?ԏont> ?펳 'ASP 0178 : 80070005'
Server.CreateObject ?Îʴ펳
/common/function.asp??А 8
?첩ȨϞʱ???ԠServer.CreateObject ?ĵ???ܡ??ܾ??ԏÎʡ?
新版本pj blogcomm.asp代码部分修改了 行不通了哦 
小戒 于 [09/02/2008 23:30:20] 回复
没测试过新版本。呵呵。
prefect! 支持
你的皮肤在1024x768下严重错位。
www.nextway.cn
www.nextway.cn
这样不错了,可以把信箱和主页文字去掉保留图片即可了~
不写邮箱和网址会提示...格式错误啊~
不写邮箱和网址会提示...格式错误啊~
邮箱和网址不要是必须项的为好啊~
要不会给访客带来麻烦,有心的人自然会写这些~
要不会给访客带来麻烦,有心的人自然会写这些~
可以把邮箱和网址以带链接的图片显示出来,效果更佳~
发表评论
上一篇
下一篇

文章来自:
Tags: 