⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.asp

📁 个人博客
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/bloginfo.asp"-->
<!--#include file="inc/userinfo.asp"-->
<!--#include file="inc/showcode.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/calendar.asp"-->
<%
dim action
show_username=ReplaceBadChar(trim(request.QueryString("name")))
action=trim(request.QueryString("action"))

if action="addmessage" then
	if CheckUserLogined()=true then
		call addmessage()
	else
		if enguestcomment="true" then
			if trim(request("password"))<>"" then
				call commentlogin()
				if CheckUserLogined()=true then
					call addmessage()
				end if
			else
				call addmessage()
			end if
		else
			if CheckUserLogined()=false then
				call commentlogin()
				if CheckUserLogined()=true then
					call addmessage()
				end if
			else
				call addmessage()
			end if
		end if
	end if
end if
call usershow()
response.Write "<Script>quote='';</Script>"
call sub_showmessage("where mainuser='"&show_username&"'",user_shownewmessage_num,"message.asp?name="&show_username)
show=replace(show,"$show_log$",show_message)
response.Write show
call bottom()

dim password,CookieDate,rsreg,sql
sub commentlogin()
dim sql
username=replace(trim(request("username")),"'","")
password=replace(trim(Request("password")),"'","")
if UserName="" then
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""对不起!用户名不能为空!"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
end if
if Password="" then
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""对不起!密码不能为空!"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
end if
if CookieDate="" then
	CookieDate=0
else
	CookieDate=Clng(CookieDate)
end if
set rs=conn.execute("select lockip from lockip where lockip='"&Request.ServerVariables("REMOTE_ADDR")&"'")
if not (rs.bof or rs.eof) then
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""对不起!你的IP已被锁定,不能登陆!"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
else
	if ot_user then
		call ot_chklogin()
	else
		call ob_chklogin()
	end if	
end if
end sub


'**************************************************
'过程名:addmessage
'作  用:添加留言
'参  数:无
'**************************************************
sub addmessage()
	if ChkPost()=false then
		response.write("不允许从外部提交!")
		response.clear
		response.End()
	end if
	dim rs,sql,subjectid,classid,mainuser
	set rs=conn.execute("select lockip from lockip where lockip='"&Request.ServerVariables("REMOTE_ADDR")&"'")
	if not (rs.bof or rs.eof) then
		Response.Write"<script language=JavaScript>"
		Response.Write"alert(""对不起!你的IP已被锁定,不能发表留言!"");"
		Response.Write"window.history.go(-1);"
		Response.Write"</script>"
	end if
	'增加用户表留言数
	conn.execute("update [user] set messagecount=messagecount+1 where username='"&show_username&"'")
		
	'增加系统留言数
	conn.execute("update [bloginfo] set messagecount=messagecount+1 ")
	
	'添加留言
	set rs=server.createobject("adodb.recordset")
	sql="select * from message"
	rs.open sql,conn,1,3
	rs.addnew
	rs("mainuser")=show_username
	if CheckUserLogined()=true then
		rs("message_user")=username
	else
	     rs("message_user")=request.Form("username")&"(游客)"
	end if
	rs("message")=debadstr(request.Form("edit"))
	rs("messagetopic")=debadstr(request.Form("messagetopic"))
	rs("homepage")=request.Form("homepage")
	rs("addtime")=blognow()
	rs("addip")=Request.ServerVariables("REMOTE_ADDR")
	rs.update
	rs.close
	Response.Redirect("message.asp?name="&show_username)
end sub

function debadstr(str)
	dim rs,badstr,i
	debadstr=str
	set rs=conn.execute("select blogFiltrate from filtrate")
	badstr=split(rs(0),"|")
	for i=0 to ubound(badstr)
	debadstr=replace(debadstr,badstr(i),"***")
	next
end function

'**************************************************
'过程名:sub_showmessage
'作  用:显示留言版
'参  数:where 条件,显示条数,连接名
'**************************************************
sub sub_showmessage(sql,num,strurl)
	dim show_logcyc,show_topic,show_loginfo,show_logtext,show_more,commenttopic,homepage
	dim rs,rssubject
	dim show_addtime,show_author,show_topictxt
	'response.Write(strurl)
	dim count,pagesize,pagecount,page,temp
	'=======以下为分页设置=====================
	'num=2
	pagesize=num '每页显示多少篇回复
	set rs=conn.execute("select count(id) from message where mainuser='"&show_username&"'")
	count=rs(0)
	set rs=nothing
	if (count mod pagesize)=0 then
    	pagecount= count \ pagesize
	else
    	pagecount= (count \ pagesize)+1
	end if
	if request.querystring("page")<>"" then
    	page=request.querystring("page")
	    if page<=0 then page=1
	else
    	page=1
	end if
	'===============以下为显示代码===============
	show_message="<div align=left><b>  给"&show_username&"签写留言</b><hr noshade></div>"
	show_message=show_message&"<table width='90%' border='0' align='center' cellspacing='0' cellpadding='0'> <tr> <td><table align='left' width='400' border='0' cellspacing='0' cellpadding='0'>" & vbcrlf
	show_message=show_message&  "<form action='message.asp?name="&show_username&"&action=addmessage' method='post' name='commentform' onSubmit='return Verifycomment()'>" & vbcrlf
    show_message=show_message&   "<tr><td height='25' align='left'>昵称:<input name='UserName' type='text' id='UserName' size='12' maxlength='20' value='"&Request.Cookies("oblog")("UserName")&"'></td>" & vbcrlf
    show_message=show_message&  "<td height='25' align='left'>密码:<input name='Password' type='password' id='Password' size='15' maxlength='20' value='"&Request.Cookies("oblog")("Password")&"'></td></tr>" & vbcrlf
	show_message=show_message&"<tr ><td height='25' align='left' colspan='4' >主页:<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://'><td></tr>"
	show_message=show_message&  "<tr ><td height='25' align='left' colspan='4'>标题:<input name='messagetopic' type='text' id='messagetopic' size='42' maxlength='50' value=''><td></tr>"
    show_message=show_message&   "<tr  height='200'><td  colspan='4'><INPUT type='hidden' name='edit' id='edit' value=''>"& vbcrlf
	show_message=show_message&   aApplicationValue(31) & vbcrlf
	show_message=show_message&  "</td></tr>" & vbcrlf
	show_message=show_message&   "<tr><td height='30' colspan='4'><input name='login' type='submit' id='Login' value=' 提交 '> " & vbcrlf
    show_message=show_message&  "</td>" & vbcrlf      
    show_message=show_message&   "</tr></form></table></td> </tr></table>" & vbcrlf
	show_message=show_message&   "<div align=left><hr noshade><b>  所有留言</b></div>" & vbcrlf	
		set rs=conn.execute("select message_user,messagetopic,message,addtime,homepage,id from message "&sql&" order by id desc")		
		if not rs.eof then
			dim isshowpage
			isshowpage=true
			if page <>1 then rs.move pagesize*(page-1)
	         for temp=1 to pagesize
			 	if rs.eof then exit for
				if isnull(rs(4)) then
					homepage=""
				else
					if trim(replace(rs(4),"http://",""))="" then
						homepage=""
					else
						homepage="<a href='"&HTMLEncode(rs(4))&"' target='_blank'>个人主页</a>"
					end if
				end if
			  	show_topic=rs(1)&"<a name='"&rs(5)&"'></name>"
				show_author=rs(0)
				show_topictxt=show_topic
				show_addtime=rs(3)
				show_loginfo=show_author&"发表留言于"&show_addtime
				show_logtext=filtimg(filtscript(rs(2)))
				show_more=homepage
				show_logcyc=replace(show_logtmp,"$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$",show_author)
				show_logcyc=replace(show_logcyc,"$show_addtime$",show_addtime)
				show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topictxt)
				show_message=show_message&show_logcyc
				rs.movenext
			next

	
	'===================分页尾部=======================
	dim pagelist
	dim pot,i
	strurl=joinchar(strurl)
	if page-1 mod 10=0 then
       pot=(page-1) \ 10
	else
       pot=(page-1) \ 10
	end if
 
	if page=1 then 
        pagelist=" <font face=webdings color='red'>9</font> "
	else
        pagelist=" <a href='"&strurl&"page=1' title=首页><font face=webdings>9</font></a> "
	end if
 
	if pot*10>0 then pagelist=pagelist &  " <a href='"&strurl&"page="&Cstr(pot*10)&"' title=上十页><font face=webdings>7</font></a> "
 
	pagelist=pagelist & "<b>" 
 
	for i=pot*10+1 to Pot*10+10
          if i=cint(Page) then
                    pagelist=pagelist & " <font color='red'>"+Cstr(i)+"</font> "
          else
     pagelist=pagelist & " <a href='"&strurl&"page="&Cstr(i)&"'>"+Cstr(i)+"</a> "
          end if
          if i=pagecount then exit for 
	next
 
	pagelist=pagelist & "</b>"

	if i<pagecount then pagelist=pagelist & " <a href='"&strurl&"page="&Cstr(i)&"' title=下十页><font face=webdings>8</font></a> "
	if Page=pagecount then
           pagelist=pagelist & "<font face=webdings color='red'>:</font>"
	else
           pagelist=pagelist & " <a href='"&strurl&"page="&Cstr(pagecount)&"' title=尾页><font face=webdings>:</font></a> "
	end if

	dim showpage
'	showpage="页次:"&page&"/"&pagecount&" "
'	showpage=showpage&"每页:"&pagesize
	showpage=showpage&"留言数:"&count&" "
		if isshowpage=false then 
			showpage=""
		else
			showpage="<div align=right>"&showpage&pagelist&"</div>"
		end if
		show_message=show_message&showpage
	else
	show_message=show_message&"<br>当前无留言!"
	end if
end sub


%>
<SCRIPT language="javascript">
<!--
function del_space(s)
{
	for(i=0;i<s.length;++i)
	{
	 if(s.charAt(i)!=" ")
		break;
	}

	for(j=s.length-1;j>=0;--j)
	{
	 if(s.charAt(j)!=" ")
		break;
	}

	return s.substring(i,++j);
}

function Verifycomment()
{
	v = del_space(document.commentform.messagetopic.value);
     if (v.length == 0)
     {
        alert("您忘了填写题目!");
	return false;
     }
	 
	 v = del_space(document.commentform.UserName.value);
     if (v.length == 0)
     {
        alert("您忘了留下名字!");
	return false;
     }
	//document.commentform.message.value=edit3.getHTML();
	submits(); 
	if (document.commentform.edit.value == "")
     {
        alert("内容不能为空!");
	return false;
     }
		
	return true;
}
//-->
</SCRIPT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -