共计 346 个字符,预计需要花费 1 分钟才能阅读完成。
很多博客默认都是邮箱不显示或者只对博主显示的,并且要求必须输入邮箱地址。因为邮箱地址除了对博主回复有用外,显示出来对访客私人信息有泄漏之嫌,容易被邮件搜索器搜索以至于被发送大量垃圾邮件。
论坛里也屡有人提出这一点,但官方开发团队一直没人对这个做出回应。想想这个修改其实也简单,中午没事就修改了一下。修改方法如下,仅供参考(基于pjblog300版本,不过这些地方基本类似。如果你的是其他版本,查找替换代码时注意是否有不同,如有不同对照修改部分更正):
1、访客留言必须输入邮箱地址
修改文件:blogcomm.asp
查找: If DateDiff("s", Request.Cookies(CookieName)("memLastPost"), DateToStr(now(),"Y-m-d H:I:S"))
单击返回"
ReInfo(2) = "WarningIcon"
postcomm = ReInfo
Exit Function
End If
在其下面加入如下代码: If Len(post_Email)<1 Then '添加必须输入邮箱验证 2009-8-31 by志文工作室 ReInfo(0) = "评论发表错误信息" ReInfo(1) = "您没有输入邮箱地址,请返回输入
您的邮箱地址不会被公开
单击返回"
ReInfo(2) = "ErrorIcon"
postcomm = ReInfo
Exit Function
End If
2、修改只对博主显示
修改文件:class/cls_article.asp
查找: If IsBlank(pjblogCommentEmail) Then
pjblogCommentEmail = "javascript:void(0)"
pjblogCommentEmailImg = "images/noCommentEmail.gif"
Else
pjblogCommentEmail = "mailto:" & pjblogCommentEmail
pjblogCommentEmailImg = "images/CommentEmail.gif"
End If
修改为:
If Not IsBlank(pjblogCommentEmail) And Stat_Admin Then '邮箱地址只对管理员显示
' pjblogCommentEmail = "javascript:void(0)"
' pjblogCommentEmailImg = "images/noCommentEmail.gif"
'Else
pjblogCommentEmailImg = "images/CommentEmail.gif"
pjblogCommentEmail = "| "
Else
pjblogCommentEmail=""
End If
If IsBlank(pjblogCommentWebSite) Then
pjblogCommentWebSite = "javascript:void(0)"
pjblogCommentWebSiteImg = "images/nositeurl.gif"
Else
pjblogCommentWebSiteImg = "images/siteurl.gif"
End If
查找:
ShowComm = ShowComm&"["&DateToStr(commArr(3,Pcount),"Y-m-d H:I A")&" |
|
|
"
替换为: ShowComm = ShowComm&"["&DateToStr(commArr(3,Pcount),"Y-m-d H:I A")&" | "&pjblogCommentEmail&"|
|
"
OK,保存上传(老习惯:注意备份文件),测试对比效果:
ps:
如果不想强制输入邮箱,第一步不要做就行了。要求留下邮箱是为了方便回复通知访客,因为一般访客留言了则说明他关注了这篇文章,所以对他自己的留言回复邮件通知,则可以帮助提高用户粘度。再者,真的不想留下自己的邮箱,随便写一个不存在的地址比如@1.cn之类也可以留言。
此外也可以加入cookie的读取判断,让访客可以查看自己的地址、可以删除自己留言等。
相关文章:











