评论留言增加邮箱网址及博主回复通知评论留言人 For Pj3  157(11/2日修改网址判断)

温馨提示:请用Dreamweaver或EditPlus编辑修改,修改前请做好备份。
注意:此功能基于留言评论邮件通知博主(增加后台开关)For pj3(http://www.leoyung.com/article/7964.htm),否则发送不了邮件。
打开class/cls_article.asp,找到:
              <%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" onfocus="this.select()"/> <%=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%>


找到:
             ShowComm = ShowComm&"<a href=""member.asp?action=view&memName="&Server.URLEncode(blog_CommAuthor)&"""><strong>"&blog_CommAuthor&"</strong></a>"


在下面插入:
            if trim(commArr(10,Pcount))<>"" then
                ShowComm = ShowComm&" <a href=mailto:"&trim(commArr(10,Pcount))&" target=_blank><img src=images/email1.gif border=0></a>"
            else
                ShowComm = ShowComm&" <img src=images/noemail1.gif>"
            end if
            
            if trim(commArr(11,Pcount))<>"" and trim(commArr(11,Pcount))<>"http://" then
                ShowComm = ShowComm&" <a href="&trim(commArr(11,Pcount))&" target=_blank><img src=images/url1.gif border=0></a>"
            else
                ShowComm = ShowComm&" <img src=images/nourl1.gif>"
            end if


找到:
   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&" 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&" orDER BY comm_PostTime "&comDesc


打开Template/static.htm,找到:
                <tr id="passArea">
                    <td align="right" width="70"><strong>密 码:</strong></td>
                    <td align="left" style="padding:3px;"><input name="password" type="password" size="18" class="userpass" maxlength="24"/> 游客发言不需要密码.</td>
                </tr>


在下面插入:
                <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>
                <tr>
                    <td align="right" width="70"><strong>网 址:</strong></td>
                    <td align="left" style="padding:3px;"><input name="myblogsiteurl" type="text" size="18" value="http://" class="userpass" maxlength="24"/></td>
                </tr>


打开blogcomm.asp,找到:
    password = Trim(CheckStr(request.Form("password")))

在下面插入:
    dim email,tsiteurl
    email=trim(CheckStr(request.form("myblogemail")))
    tsiteurl=trim(CheckStr(request.form("myblogsiteurl")))    


找到:
    If (memName=empty or blog_validate=true) and (cstr(lcase(Session("GetCode")))<>cstr(lcase(validate)) or IsEmpty(Session("GetCode"))) Then


在上面插入:
    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 tsiteurl<>"" and tsiteurl<>"http://" and IsRightUrl(tsiteurl)=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",tsiteurl))


找到:
    Conn.Execute("update blog_Content set log_CommNums=log_CommNums+1 where log_ID="&post_logID)

将上面‘评论留言通知’之间的代码,全部替换:
    '评论邮件通知
    Dim email_commid, SQLcomm, log_commcomm
    SQLcomm="Select TOP 1 * FROM blog_Comment Where comm_Author='"&username&"' order By comm_ID Desc "
    Set log_commcomm=conn.execute(SQLcomm)
        email_commid=log_commcomm("comm_ID")
    log_commcomm.Close
    Set log_commcomm=Nothing
    dim email_log_title
    SQLcomm="Select * FROM blog_Content Where log_ID="&post_logID&""
    Set log_commcomm=conn.execute(SQLcomm)
        email_log_title=log_commcomm("log_Title")
    log_commcomm.Close
    Set log_commcomm=Nothing
    If blog_Isjmail Then
        dim emailcontent,emailtitle
        emailtitle = "您发表的文章《"&email_log_title&"》已有客人发表了评论"
        if blog_postFile = 2 then
            emailcontent = "["&username&"]在您的博客中发表了评论,请点击查"&siteURL&"article/"&post_logID&".htm#comm_"&email_commid&"。评论内容如下:"&post_Message&""
        else
            emailcontent = "["&username&"]在您的博客中发表了评论,请点击查"&siteURL&"default.asp?id="&post_logID&"#comm_"&email_commid&"。评论内容如下:"&post_Message&""
        end if
        call sendmail(blog_email,emailtitle,emailcontent)
'        call sendmail(username,post_logID,email_commid,email_log_title,1,post_Message)
    End If
    '评论邮件通知结束


打开reply.asp,找到:
    set quest = Conn.Execute("select top 1 comm_Content from blog_Comment where comm_ID=" & cID)

替换为:
    set quest = Conn.Execute("select top 1 a.comm_Content,a.comm_Author,b.log_title,b.log_ID,a.email from blog_Comment a inner join blog_Content b on a.blog_ID=b.log_ID where a.comm_ID=" & cID)


找到:
     PostArticle logId, False


在上面插入:

        If blog_Isjmail and trim(quest(4))<>"" Then
            dim emailcontent,emailtitle
            emailtitle = "您在"&siteName&"上发表的评论已被回复"
            dim CommUrl
            if blog_postFile = 2 then
                CommUrl = "请点击查看"&siteurl&"article/"&quest(3)&".htm#comm_"&cID&"。"
            else
                CommUrl = "请点击查看"&siteurl&"default.asp?id="&quest(3)&"#comm_"&cID&"。"
            end if
            emailcontent = "尊敬的{"&quest(1)&"},您好,你在["&siteName&"]上发表的关于["&quest(2)&"]日志的评论,现已被["&memName&"]回复,回复内容为:["&replay&"],"&CommUrl&"谢谢您的评论,欢迎再次光临!"
            call sendmail(quest(4),emailtitle,emailcontent)
end if


打开Plugins/GuestBook/guestbook.asp,找到:
                    <a href="member.asp?action=view&memName=<%=Server.URLEncode(GuestDB("book_Messager"))%>"><b><%=GuestDB("book_Messager")%></b></a>

在下面插入:
<%
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 memName=empty then%><tr><td align="right" width="70"><strong>密 码:</strong></td><td align="left" style="padding:3px;"><input name="password" type="password" 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="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%>


打开Plugins/GuestBook/bookaction.asp,找到:
  post_Message=CheckStr(request.form("Message"))

在下面插入:
dim email,tsiteURL
  email=trim(CheckStr(request.form("myblogemail")))
  tsiteURL=trim(CheckStr(request.form("myblogsiteurl")))

找到:
  if filterSpam(post_Message,"../../spam.xml") and stat_Admin=false then
      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 tsiteURL<>"" and tsiteURL<>"http://" and IsRightUrl(tsiteURL)=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) 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&"','"&tsiteURL&"')")

找到:
Response.Cookies(CookieName)("bookLastPost")=DateToStr(now(),"Y-m-d H:I:S")

将下面‘评论留言通知’之间的代码,全部替换:
    '留言邮件通知
    If blog_Isjmail Then
        Dim SQLcomm, log_commcomm
        SQLcomm="Select TOP 1 * FROM blog_book Where book_ID="&MsgID
        Set log_commcomm=conn.execute(SQLcomm)
        if trim(log_commcomm("email"))<>"" then
            dim emailcontent,emailtitle
            emailtitle = "您在"&siteName&"上发表的留言已被回复"
            emailcontent = "尊敬的{"&log_commcomm("book_Messager")&"},您好,您在["&siteName&"]上发表的留言,现已被["&memName&"]回复,回复内容为:["&MsgReplyContent&"],请点击查看"&siteURL&"LoadMod.asp?plugins=GuestBookForPJBlog#book_"&MsgID&"。谢谢您的留言,欢迎再次光临!"
            call sendmail(log_commcomm("email"),emailtitle,emailcontent)
    '        call sendmail(username,"",email_bookid,"",0,post_Message)
        end if
        log_commcomm.Close
        Set log_commcomm=Nothing
    End If
    '留言邮件通知结束


找到:
   showmsg "回复信息","回复留言成功!<br/><a href=""LoadMod.asp?plugins=GuestBookForPJBlog"">单击返回留言本</a>","MessageIcon","plugins"

在上面插入:
    '留言邮件通知
        Dim SQLcomm, log_commcomm
        SQLcomm="Select TOP 1 * FROM blog_book Where book_ID="&MsgID
        Set log_commcomm=conn.execute(SQLcomm)
        if trim(log_commcomm("email"))<>"" then
            dim emailcontent,emailtitle
            emailtitle = "您在"&siteName&"上发表的留言已被回复"
            emailcontent = "尊敬的{"&log_commcomm("book_Messager")&"},您好,您在["&siteName&"]上发表的留言,现已被["&memName&"]回复,回复内容为:["&MsgReplyContent&"],请点击查看"&siteURL&"LoadMod.asp?plugins=GuestBookForPJBlog#book_"&MsgID&"。谢谢您的留言,欢迎再次光临!"
            call sendmail(log_commcomm("email"),emailtitle,emailcontent)
    '        call sendmail(username,"",email_bookid,"",0,post_Message)
        end if
        log_commcomm.Close
        Set log_commcomm=Nothing
    '留言邮件通知结束


打开common/function.asp,在最后一个之前,插入如下代码:
Function IsRightUrl(UrlStrng)  '网址判断
  Dim regEx, retVal
  Set regEx = New RegExp
  regEx.Pattern = "^((https|http|ftp|rtsp|mms)?://)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6})(:[0-9]{1,4})?((/?)|(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"
  regEx.IgnoreCase = False
  retVal = regEx.Test(UrlStrng)


  If retVal Then
    IsRightUrl = true
  Else
    IsRightUrl = false
  End If
End Function


找到:
Function sendmail(username,post_logID,email_commid,email_log_title,comm,post_Message)  '邮件发送

到最近一个
End Function
之间的所有代码,包括这两句,全部替换(如果之前没有添加过,请直接添加):
Function sendmail(blogemail,emailtitle,emailcontent)  '邮件发送
    on error resume next
    if trim(blog_jmail)="1" then
            Set msg = Server.CreateObject("JMail.Message")
            msg.silent = true
            msg.Logging = true
            msg.Charset = "gb2312"
            msg.MailServerUserName = blog_smtpuser
            msg.MailServerPassword = blog_smtppassword  
            msg.From = blog_smtpmail
            msg.FromName = sitename
            msg.AddRecipient blogemail,sitename
            msg.Subject = emailtitle
            msg.Body = emailcontent
            msg.Send(blog_smtp)
            msg.close
            set msg = nothing
    Else
            Set objMail = Server.CreateObject("CDONTS.NewMail")
            objMail.To = blogemail
            objMail.From =blog_smtpmail
            objMail.Subject = emailtitle
            objMail.Body = emailcontent
            objMail.Send
            Set objMail = Nothing
    End If
End Function


如果之前没加过评论留言加网址和邮箱功能,请下载附件,升级数据库,否则请跳过。下载文件 点击下载附件

OK,全文结束。如果是全静态,修改完成后到后台重新生成。下载文件 我站的留言本


[本日志由 小戒 于 2008-12-08 10:17 PM 编辑]
上一篇: 30多个CSS和JS下拉菜单资源
下一篇: MYSQL远程连接工具及设置
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 评论 留言 邮箱 网址 通知
相关日志:
评论: 51 | 引用: 0 | 查看次数: -
小伊
回复回复小伊[2009-10-16 05:45 AM | | | del]
支持~~~~~~
小伊
回复回复小伊[2009-10-16 05:44 AM | | | del]
好东西都在这里挖
小文
回复回复小文[2009-09-30 11:35 PM | | | del]
请问一下戒聊大哥.
我想安装这个评论就把 密码替换成邮箱
(针对游客) 因为我打算网站不提供注册.
只允许访问者发言

就是把密码那栏 换成 邮箱  总的来说 就是发言者需要输入 昵 称 和邮箱 2个比填的
具体怎么改
回复来自 小戒 的评论 小戒 于 2009-10-01 01:07 PM 回复
不再提供PJ技术支持,抱歉.
rwr
回复回复rwr[2009-09-03 09:15 AM | | | del]
公司可单独提供税务(合理降低税务成本)可提供发票www.wdylqc.cn最专业的发票咨询网
阅城
回复回复阅城[2009-08-10 09:08 AM | | | del]
第三次留言,我的头像怎么还是这个呢
回复来自 小戒 的评论 小戒 于 2009-08-10 09:26 AM 回复
这个是直接根据你的邮箱取的你的头像,如果没变就是那边还没更新过来了。
阅城
回复回复阅城[2009-08-10 09:01 AM | | | del]
再看一下~
阅城
回复回复阅城[2009-08-10 08:54 AM | | | del]
测试~
kc.design
回复回复kc.design[2009-07-04 05:13 PM | | | del]
老大,,问题出现. 版本为最新版.

错误类型:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'blog_Isjmail'
/web/Plugins/GuestBook/bookaction.asp, 第 140 行

问题出在哪啊??
回复来自 小戒 的评论 小戒 于 2009-08-10 09:19 AM 回复
这个只适合157呢。。。。你的最新版是什么版本?
加一句dim blog_Isjmail
海天无影1
回复回复海天无影1[2009-05-15 04:23 PM | | | del]
汗 像这两个if memName=empty and email<>"" and IsValidEmail(email)=false then判断 不应该需要memName=empty
回复来自 小戒 的评论 小戒 于 2009-05-15 04:37 PM 回复
好像有些道理。MEMNAME是判断是否注册用户的。

回复来自 小戒 的评论 小戒 于 2009-05-15 04:37 PM 回复
你可以研究下,然后自己修改下。
海天无影1
回复回复海天无影1[2009-05-15 04:02 PM | | | del]
果真如此 有的人不注意会把网址里的http://这几个去掉,那发表后显示的网址就是错误的……具体看我下面那个测试的网址。
这个怎么解决啊。
回复来自 小戒 的评论 小戒 于 2009-05-15 04:19 PM 回复
那就没必要去理他了。已经帮他填好了网址又跑去删。程序并不能代替人脑,我可以判断他是否有输入HTTP,但他要是输入个HTP呢???
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 支持Gravatar头像.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.