www.gusucode.com > 易心博客[圣诞版] 3.5手动安装码程序 > MsgPost.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn.asp"--> <!--#include file="Ex_Cls/Ex_SkinCls.asp"--> <!--#include file="Ex_Cls/Ex_SplitPageCls.asp"--> <% Dim ExComm Set ExComm=new Ex_CommonCls ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin") ExComm.CheckInstall ExComm.IsIpAllow Dim Title,Show_logids,show_blogKeyword '************************************************** '显示留言编辑框 '************************************************** function show_msgpost() show_msgpost=show_msgpost&"<center><form method=""POST"" action=""msgpost.asp?action=save"">" show_msgpost=show_msgpost&" <div align=""center"">" show_msgpost=show_msgpost&" <center>" show_msgpost=show_msgpost&" <table border=""0"" width=""98%"">" show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""30%"">昵称:<font color=""red"">*</font></td>" show_msgpost=show_msgpost&" <td width=""70%"" style=""text-align:left;""><input type=""text"" name=""username"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("uname"))&"""></td>" show_msgpost=show_msgpost&" </tr>" show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""30%"">密码:</td>" show_msgpost=show_msgpost&" <td width=""70%"" style=""text-align:left;""><input type=""password"" name=""userpass"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("upwd"))&"""><font color=red> [游客不必填写]</font></td>" show_msgpost=show_msgpost&" </tr>" show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""30%"">主页:</td>" show_msgpost=show_msgpost&" <td width=""70%"" style=""text-align:left;""><input type=""text"" name=""homepage"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("homepage"))&"""></td>" show_msgpost=show_msgpost&" </tr>" If Application(sn&"IsCheckCode")="是" Then show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""30%"">验证码:<font color=""red"">*</font></td>" show_msgpost=show_msgpost&" <td width=""70%"" style=""text-align:left;""><input type=""text"" name=""checkcode"" size=""10""><img src=""inc/checkcode.asp"" style=""cursor:hand"" onclick=""this.src='inc/checkcode.asp';"" alt=""看不清?点一下"" /></td>" show_msgpost=show_msgpost&" </tr>" End If show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""30%"">标题:<font color=""red"">*</font></td>" show_msgpost=show_msgpost&" <td width=""70%"" style=""text-align:left;""><input type=""text"" name=""title"" size=""35""></td>" show_msgpost=show_msgpost&" </tr>" show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""100%"" colspan=""2"" style=""text-align:center;""> <textarea name=""content"" style=""width:290px;height:90px;""></textarea></td>" show_msgpost=show_msgpost&" </tr>" show_msgpost=show_msgpost&" <tr>" show_msgpost=show_msgpost&" <td width=""100%"" colspan=""2""><input type=""submit"" value=""提交"" name=""B1""></td>" show_msgpost=show_msgpost&" </tr>" show_msgpost=show_msgpost&" </table>" show_msgpost=show_msgpost&" </center>" show_msgpost=show_msgpost&" </div>" show_msgpost=show_msgpost&"</form></center><br>提示:代<font color=""red"">*</font>的和内容必须填写!!" End function '************************************************** '显示留言内容 '************************************************** Function show_msgmore(ExSkin) Dim id,sql,rs,tempstr Dim show_logtext,show_topic,show_loginfo,show_more,show_logcyc,show_topicurl,msgname,show_topictxt Dim Skin2,Skin3 id=clng(request.querystring("id")) sql="select * from Ex_message where id="&id Set rs=Conn.execute(sql) If Not rs.eof And Not rs.bof Then show_logtext=rs("content") show_topictxt=rs("title") title=show_topic msgname=show_topic show_topic="<a href=msgpost.asp?id="&rs("id")&">"&show_topictxt&"</a>" show_loginfo=rs("username")&"于"&rs("submittime")&"发表" show_more="<a href=msgpost.asp?id="&rs("id")&">阅读全文("&rs("bits")&")</a>" Show_more=Show_more&" | "&"<a href=msgpost.asp?id="&rs("id")&">回复("&rs("reply")&")</a>" If ExComm.IsLogin("admin") Then show_more=show_more&" | "&"<a href=msgpost.asp?id="&rs("id")&">回复("&rs("reply")&")</a> | <a href=Admin_Msg.asp?action=del&id="&rs("id")&" onclick=""return confirm('是否要删除?删除后关于本留言的回复也将被删除.')"">删除</a>" End If show_topicurl="msgpost.asp?id="&rs("id") Skin2=ExSkin.GetTxtSkin("show_log.html") Skin3=ExSkin.GetTxtSkin("show_logcmt.html") show_logcyc=replace(Skin2,"$show_topic$",show_topic) show_logcyc=replace(show_logcyc,"$show_loginfo$",show_loginfo) show_logcyc=replace(show_logcyc,"$show_logtext$",show_logtext) show_logcyc=replace(show_logcyc,"$show_more$",show_more) show_logcyc=replace(show_logcyc,"$show_emot$","") show_logcyc=replace(show_logcyc,"$show_author$",rs("username")) show_logcyc=replace(show_logcyc,"$show_addtime$",rs("submittime")) show_logcyc=replace(show_logcyc,"$show_topic$",show_topic) show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topictxt) show_logcyc=replace(show_logcyc,"$show_topicurl$",show_topicurl) show_logcyc=replace(show_logcyc,"$show_logcls$","<a href=""msgpost.asp"">返回列表</a>") show_logcyc=replace(show_logcyc,"$show_copyright$","") show_logcyc=replace(show_logcyc,"$show_adscnthead$","") show_logcyc=replace(show_logcyc,"$show_adscntbottom$","") rs.close Set rs=Nothing tempstr=tempstr&show_logcyc Conn.execute("update Ex_message set bits=bits+1 where id="&id) Dim ExPages,page Set ExPages=new Ex_SplitPageCls Expages.letConn=Conn Expages.letColumns="select *" ExPages.letDataFrom="from Ex_message" ExPages.letWhere="where parentid="&id Set rs=server.CreateObject("adodb.recordset") Expages.letPageSize=5 If ExComm.G(request("page"))="" Then page=1 Else page=ExComm.G(request("page")) End if ExPages.letPage=CInt(page) ExPages.letStrPage="" ExPages.Execute() Set Rs=ExPages.GetRs If ExPages.GetRsCount<>0 then Do While Not rs.eof show_logtext=rs("content") show_topic=rs("title") show_loginfo=rs("username")&"于"&rs("submittime")&"发表" If ExComm.IsLogin("admin") Then show_loginfo=show_loginfo&" | <a href=Admin_Msg.asp?action=del&id="&rs("id")&" onclick=""return confirm('是否要删除?删除后关于本留言的回复也将被删除.')"">删除</a>" End If show_more="" If ExComm.IsOblogSkin Then show_logcyc=replace(Skin2,"$show_topic$",show_topic) Else show_logcyc=replace(Skin3,"$show_topic$",show_topic) End If show_logcyc=replace(show_logcyc,"$show_loginfo$",show_loginfo) show_logcyc=replace(show_logcyc,"$show_logtext$",show_logtext) show_logcyc=replace(show_logcyc,"$show_more$",show_more) show_logcyc=replace(show_logcyc,"$show_emot$","") show_logcyc=replace(show_logcyc,"$show_author$",rs("username")) show_logcyc=replace(show_logcyc,"$show_addtime$",rs("submittime")) show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topic) show_logcyc=replace(show_logcyc,"$show_logid$","") show_logcyc=replace(show_logcyc,"$show_copyright$","") show_logcyc=replace(show_logcyc,"$show_adscnthead$","") show_logcyc=replace(show_logcyc,"$show_adscntbottom$","") rs.movenext tempstr=tempstr&show_logcyc Loop dim showpage showpage=showpage&"<div align=center>"&ExPages.Show&"</div>" tempstr=tempstr&showpage End If Set rs=Nothing show_msgmore=show_msgmore&tempstr show_msgmore=show_msgmore&"<form method=""POST"" action=""msgpost.asp?action=reply&parentid="&id&"&id="&id&""">" show_msgmore=show_msgmore&" <div align=""center"">" show_msgmore=show_msgmore&" <center>" show_msgmore=show_msgmore&" <table border=""0"" width=""98%"">" show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""30%"">昵称:<font color=""red"">*</font></td>" show_msgmore=show_msgmore&" <td width=""70%"" style=""text-align:left""><input type=""text"" name=""username"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("uname"))&"""></td>" show_msgmore=show_msgmore&" </tr>" show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""30%"">密码:</td>" show_msgmore=show_msgmore&" <td width=""70%"" style=""text-align:left""><input type=""password"" name=""userpass"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("upwd"))&"""><font color=red> [游客不必填写]</font></td>" show_msgmore=show_msgmore&" </tr>" show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""30%"">主页:</td>" show_msgmore=show_msgmore&" <td width=""70%"" style=""text-align:left""><input type=""text"" name=""homepage"" size=""20"" value="""&ExComm.UnDeCode(request.Cookies(Md5(sn))("homepage"))&"""></td>" show_msgmore=show_msgmore&" </tr>" If Application(sn&"IsCheckCode")="是" Then show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""30%"">验证码:<font color=""red"">*</font></td>" show_msgmore=show_msgmore&" <td width=""70%"" style=""text-align:left""><input type=""text"" name=""checkcode"" size=""10""><img src=""inc/checkcode.asp"" style=""cursor:hand"" onclick=""this.src='inc/checkcode.asp';"" alt=""看不清?点一下"" /></td>" show_msgmore=show_msgmore&" </tr>" End If show_msgmore=show_msgmore&" <tr style=""display:none"">" show_msgmore=show_msgmore&" <td width=""30%"">标题:<font color=""red"">*</font></td>" show_msgmore=show_msgmore&" <td width=""70%"" style=""text-align:left""><input type=""text"" name=""title"" size=""35"" value=""re:"&title&"""></td>" show_msgmore=show_msgmore&" </tr><input type=hidden value="&id&" name=parentid id=parentid>" show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""100%"" colspan=""2"" style=""text-align:center;""><textarea name=""content"" style=""width:290px;height:90px;""></textarea></td>" show_msgmore=show_msgmore&" </tr>" show_msgmore=show_msgmore&" <tr>" show_msgmore=show_msgmore&" <td width=""100%"" colspan=""2""><input type=""submit"" value=""提交"" name=""B1""></td>" show_msgmore=show_msgmore&" </tr>" show_msgmore=show_msgmore&" </table>" show_msgmore=show_msgmore&" </center>" show_msgmore=show_msgmore&" </div>" show_msgmore=show_msgmore&"</form><br>提示:代<font color=""red"">*</font>的和内容必须填写!!" Else ExComm.showmsg "没有留言!!!!",Application(sn&"blogurl")&"index.asp" End If End Function '************************************************** '显示留言列表 '************************************************** Function show_msgtitle(ExSkin) Dim rs,tempstr,sql,j Dim Skin2 Skin2=ExSkin.GetTxtSkin("show_log.html") j=0 Dim ExPages,page Set ExPages=new Ex_SplitPageCls Expages.letConn=Conn Expages.letColumns="select id,title,submittime,bits,reply,content as cont,username" ExPages.letDataFrom="from Ex_message" ExPages.letWhere="where parentid=0 and isshow='是'" Expages.letOrder="order by submittime desc" Set rs=server.CreateObject("adodb.recordset") Expages.letPageSize=5 If ExComm.G(request("page"))="" Then page=1 Else page=ExComm.G(request("page")) End if ExPages.letPage=CInt(page) ExPages.letStrPage="" ExPages.Execute() Set Rs=ExPages.GetRs If ExPages.GetRsCount<>0 then Dim show_logtext,show_topic,show_loginfo,show_more,show_logcyc Do While Not rs.eof show_logtext=rs("cont") show_topic="<a href=msgpost.asp?id="&rs("id")&">"&rs("title")&"</a>" show_loginfo=rs("username")&"于"&rs("submittime")&"发表" show_more="<a href=msgpost.asp?id="&rs("id")&">阅读全文("&rs("bits")&")</a>" show_more=show_more&" | "&"<a href=msgpost.asp?id="&rs("id")&">回复("&rs("reply")&")</a>|<a href=msgpost.asp?post=true>留言</a>" If ExComm.IsLogin("admin") Then show_more=show_more&" | <a href=Admin_Msg.asp?action=del&id="&rs("id")&" onclick=""return confirm('是否要删除?删除后关于本留言的回复也将被删除.')"">删除</a>" End If show_logcyc=replace(Skin2,"$show_topic$",show_topic) show_logcyc=replace(show_logcyc,"$show_loginfo$",show_loginfo) show_logcyc=replace(show_logcyc,"$show_logtext$",show_logtext) show_logcyc=replace(show_logcyc,"$show_more$",show_more) show_logcyc=replace(show_logcyc,"$show_emot$","") show_logcyc=replace(show_logcyc,"$show_author$",rs("username")) show_logcyc=replace(show_logcyc,"$show_addtime$",rs("submittime")) show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topic) show_logcyc=replace(show_logcyc,"$show_logcls$","<a href=#>返回顶部</a>") show_logcyc=replace(show_logcyc,"$show_copyright$","") show_logcyc=replace(show_logcyc,"$show_adscnthead$","") show_logcyc=replace(show_logcyc,"$show_adscntbottom$","") rs.movenext tempstr=tempstr&show_logcyc Loop dim showpage showpage=showpage&"<div align=center>"&ExPages.Show&"</div>" tempstr=tempstr&showpage Else tempstr="没有任何留言" End If show_msgtitle=tempstr&show_msgpost End Function '*********************** '功能:回车替换 '*********************** Function FilterHtml(str) FilterHtml=replace(str, chr(13), "<BR>") End Function '*********************** '功能:静态模式下相关静态文件生成 '*********************** Sub CreateMsg End Sub '*********************** '功能:信息保存 留言和回复 '*********************** sub save() dim title,content,username,userpass,userhome,rs,strsql,parentid,checkcode,IsShow,Msg Dim ExNow ExNow=ExComm.ExNow() title=ExComm.F(request.Form("title")) content=FilterHtml(ExComm.F(request.Form("content"))) userpass=ExComm.G(request.Form("userpass")) username=ExComm.F(request.Form("username")) userhome=ExComm.F(Request.Form("homepage")) checkcode=request.Form("checkcode") if (checkcode<>session("excheckcode") Or Session("excheckcode")="") And Application(sn&"IsCheckCode")="是" then ExComm.ShowMsg "验证码不正确","" end If If Request.cookies(Application(Sn&"blogurl"))<>Sn And Application(sn&"IsCheckCode")="是" Then ExComm.ShowMsg "你是机器人吧?","" End If parentid=CLng(request.Form("parentid")) If ExComm.CheckRe(content,Application(sn&"cmtmsgcheckre")) And Application(sn&"iscmtmsgcheck")="是" Then IsShow="否" Msg="\n博客开启了留言审核功能,此信息需要审核才能显示." Else IsShow="是" Msg="" End If If title<>"" And content<>"" And username<>"" Then If Trim(userpass)="" Then Rs=Conn.execute("select count(*) from Ex_user where username='"&username&"'") If Rs(0)<>0 Then ExComm.ShowMsg "你使用的昵称已经被人注册,请更换其它昵称","" End If StrSql="insert into Ex_Message(title,content,username,submittime,parentid,isshow) values('"&title&"','"&content&"','"&username&"',#"&ExNow&"#,"&parentid&",'"&isshow&"')" Else If ExComm.CheckUNP(username,userpass) Then StrSql="insert into Ex_Message(title,content,username,submittime,parentid,userpass,isshow) values('"&title&"','"&content&"','"&username&"',#"&ExNow&"#,"&parentid&",'"&userpass&"','"&IsShow&"')" If Len(userpass)<=20 Then response.Cookies(Md5(sn))("uname")=ExComm.DeCode(username) response.Cookies(Md5(sn))("upwd")=ExComm.DeCode(md5(userpass)) response.Cookies(Md5(sn))("homepage")=ExComm.DeCode(userhome) session("user")=username End If Else ExComm.ShowMsg "帐号,密码不正确或您的帐号被锁定。","" End If End If Conn.Execute StrSql else ExComm.ShowMsg "请填写完整","" End If Application.Lock Application(sn&"msgtotal")=Application(sn&"msgtotal")+1 Application.Unlock ExComm.clearcache(sn&"newmessage") CreateMsg If parentid=0 Then ExComm.showmsg "留言成功"&Msg,"msgpost.asp" Else Conn.execute("update Ex_message set reply=reply+1 where id="&parentid) ExComm.ShowMsg "回复成功","msgpost.asp?id="&parentid End If end Sub If request.querystring("action")="save" Or Request.querystring("action")="reply" Then save End If '判断应该输出什么内容 替换$show_log$标记 Function MsgPost(ExSkin) If request.querystring("id")<>"" Then'当id不为空时 输出具体信息 msgpost=show_msgmore(ExSkin) ElseIf request.querystring("post")<>"" then'当post不为空时 输出留言框 msgpost=show_msgpost(ExSkin) Else msgpost=show_msgtitle(ExSkin)'输出留言列表 End If End Function '主模板标记替换开始 Dim ExSkin,Head,Body,Bottom,Skin1 Set ExSkin=new Ex_SkinCls Skin1=ExSkin.GetTxtSkin("default.html") Body=Replace(Skin1,"$show_log$",msgpost(ExSkin)) Body=Replace(Body,"$show_info$",ExSkin.Info) Body=Replace(Body,"$show_login$",ExSkin.Login) Body=Replace(Body,"$show_calendar$",ExSkin.calendar("","","")) Set ExSkin=Nothing Bottom=ExComm.BottomInfo Title="博客留言" '输出内容 Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf Head=Head&"<head>"&vbcrlf Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDscription")&""">"&vbcrlf Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf Head=Head&"<script src=""inc/Main.js""></script>" Head=Head&"<script src=""inc/UserInfo.js""></script>" Head=Head&"<script src=""inc/jquery.js""></script>" Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf Head=Head&"</head>"&vbcrlf Head=Head&"<body>"&vbcrlf If ExComm.IsOblogSkin Then Response.Write Head Response.Write Body Response.Write "</body></html>" Else Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord")) Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword")) Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription")) Response.Write Body End If If request.querystring("action")="add" Then Call add() End If If Application(Sn&"Runmode")<>"静态" Then ExComm.visitorCount End If Set ExComm=Nothing %>