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

📄 my_msg.asp

📁 网上购物系统 asp+sql server 2005
💻 ASP
字号:
<!--#include file="include/dbopenbd.asp" -->
<%

call checklogin()
if request("delid")<>"" then call delmsg()
%>

<HTML>
<HEAD>
<TITLE>站内消息-<%=sitename%>-<%=siteurl%></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="<%=sitedescription%>">
<meta name="keywords" content="<%=sitekeywords%>">
<link rel="stylesheet" href="include/css.css" type="text/css">
</HEAD>
<CENTER>
<!--#include file="a_top.asp"-->
<table width=760 border=0 align=center cellpadding=0 cellspacing=0 bgcolor="#FFFFFF"  class="grayline" >
<tr> 
<td align="center" valign="top" width="185"> 
<!--#include file="user_center_menu.asp"-->
</td>
<td bgcolor="#CCCCCC" width="1"></td>
<td valign="top" bgcolor="#FfFfFf" width="570"> 
<TABLE border=0 width="100%" cellspacing="2" cellpadding="2" align=center>
<tr><td  height=30>目前位置:<a href=main.asp>首页</a> > <a href=user_center.asp>用户中心</a> > 站内消息</td></tr>
<tr><td width="570"  align="center" height="1" background="images/small/bgline.gif"></td></tr></table>
<br>
<%
sql="select * from s_hand where del='0' and (name='ALL' or name='"&request.cookies("buyok")("userid")&"') order by isnew asc, riqi desc"
set rs=Server.CreateObject("ADODB.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then 
	response.write "<table width=90% border=0 align=center><tr><td><marquee width=100% height=10>暂时没有站内消息</marquee></td></tr></table>"
	else

pages = 10			'每页记录数
rs.pageSize = pages
allPages = rs.pageCount		'计算一共能分多少页
page = Request("page")
'if语句属于基本的排错处理
if isEmpty(page) or clng(page) < 1 then
page = 1
elseif clng(page) >= allPages then
page = allPages 
end if
rs.AbsolutePage = page

do while not rs.eof and  pages>0
neirong=rs("neirong")
riqi=rs("riqi")
isnew=rs("isnew")

if isnew=true then
	temp="未阅读"
elseif isnew=false then
	temp="<font color=red>已阅读</font>"
end if

fname=rs("fname")
id=rs("id")
%>
<form action=my_msg.asp method=post>
<table width="90%" border="1" cellpadding="4" cellspacing="0" bordercolor="#C0C0C0" align=center bordercolordark="#FFFFFF" style="word-break:break-all">
<tr>
<td onMouseOver="bgColor='#e7e7e7'" onMouseOut="bgColor='#FFFFFF'">
<table border=0 width=100%>
<tr><td width=120 rowspan=2>
<a href='mymsg_hand.asp?id=<%=id%>'><img alt="回复此消息" src=images/small/m_replyp.gif border=0></a> &nbsp;  
<span  style="cursor:hand" onclick="{if(confirm('提示:消息删除后不可恢复,\n\n您确实删除这条消息吗? ')){location.href='my_msg.asp?delid=<%=id%>';}}"><img ALT="删除此消息" src=images/small/m_delete.gif border=0></span>&nbsp;&nbsp;
</td><td>
<%
if rs("name")="ALL" then
	if isnew=true then
		response.write "<font color=red>这是一条新的公共短信</font>"
	else
		response.write "<font color=blue>这是一条公共短信</font>"
	end if
else
	if isnew=true then
		response.write "<font color=red>这是一条新的短信</font>"
	else
		response.write "<marquee><font color=blue>节约每一分空间,请及时删除无用短信,谢谢合作。重要资料请及时转移保存,确保安全!</font></marquee>"
	end if
end if
%>
</td></tr>
<tr><td>发送人:<%=fname%>  &nbsp;  发送时间:<%=riqi%> &nbsp; &nbsp;<b><%=temp%></b></td></tr>
<tr><td colspan=2><hr color="#FFFFFF" WIDTH=100%>
<%=replace(neirong,vbCRLF,"<BR>")%>
</td></tr>
</table>
</td></tr>
</table>
</form>
<%
pages = pages - 1
if isnew=true then
rs("isnew")=false
rs.update
end if
rs.movenext
if rs.eof then exit do
loop
response.write "<table width=90% border=0 align=center><tr><td height=50 valign=top>"
call listpages()
response.write "</td></tr></table>"

end if
rs.close
set rs=nothing
%>
</td>
</TR>
</TABLE>
<!--#include file="a_bottom.asp"--> 
</BODY></center>


<%
'分页
sub listPages() 
'if allpages <= 1 then exit sub 
if page = 1 then
response.write "<font color=darkgray>首页 前页</font>"
else
response.write "<a href="&request.ServerVariables("script_name")&"?page=1>首页</a> <a href="&request.ServerVariables("script_name")&"?page="&page-1&">前页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下页 末页</font>"
else
response.write " <a href="&request.ServerVariables("script_name")&"?page="&page+1&">下页</a> <a href="&request.ServerVariables("script_name")&"?page="&allpages&">末页</a>"
end if
response.write " 第"&page&"页 共"&allpages&"页"
end sub

sub delmsg()
    Set rs = conn.Execute("select * from s_hand where id="&request("delid")) 
	if rs.eof and rs.bof then 
		mGoBack "出错了,数据库操作失败!"
    elseif ucase(rs("name"))="ALL" then
		mGoBack "出错了,您不能删除这条消息,可能这条消息属于公共消息!"
    elseif Ucase(request.cookies("buyok")("userid"))<>Ucase(rs("name")) then
		mGoBack "出错了,您不能删除这条消息,可能这条消息属于公共消息!"
    else
        conn.Execute ("update s_hand set del='1' where id="&request("delid")) 
		mGoTo "my_msg.asp","操作成功,所选消息已被删除!"
    end if
end sub

conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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