📄 mail.asp
字号:
<!--#include file="config.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="head.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Sitename%>-站内信箱</title>
<LINK href="css.css" type=text/css rel=stylesheet>
</head>
<body>
<%sitehead%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td height="291" valign="top">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td width="83%" height="25"> <img src="skins/1/xb3.gif"> 当前位置:<a href="index.asp">首页</a> >> <a href="mail.asp">站内信箱</a></td>
<td width="17%"><a href="?type2=add">新建邮件</a></td>
</tr>
</table>
<br>
<%if session("xyluserid")="" then ShowError("请先登录!")
Select Case request("type2")
Case "edit":
Call edit
Case "edit2":
Call edit2
Case "del":
Call del
Case "add":
Call add
Case "add2":
Call add2
Case Else:
call show
End Select
sub show
rs.open "select * from [mail] where toid="&session("xyluserid")&" order by id desc",conn,1,3
If Rs.eof and Rs.bof Then
Response.Write("暂无信息")
else
dim strFileName,i,j,totalPut,CurrentPage,TotalPages
totalPut=rs.recordcount
const MaxPerPage=10
strFileName="?"
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
if currentPage<>1 and (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
else
currentPage=1
end if
i=0
do while not rs.eof%>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="2" class="border">
<tr bgcolor="#F7F7F7">
<td width="8%" height="20">ID:<%=rs(0)%></td>
<td width="20%">发送:<A href="datum.asp?userid=<%=rs("fromid")%>"><%=obj.getname(rs("fromid"),1,SiteDatabase)%></a></td>
<td width="43%">标题:<%=rs("title")%></td>
<td width="29%">时间:<%=rs("date")%></td>
</tr>
<tr valign="top">
<td height="50" colspan="4">内容:<%=rs("content")%></td>
</tr>
<tr bgcolor="#F7F7F7">
<td height="20" colspan="4"><div align="right">操作:<a href="?type2=add&toid=<%=rs("fromid")%>">回复</a> <a href="?type2=del&id=<%=rs(0)%>" onclick="return confirm('确定要删除吗?')">删除</a></div></td>
</tr>
</table>
<br>
<%if rs("isread")=0 then
rs("isread")=1
rs.update
Set rs2 = Server.CreateObject("Adodb.Recordset")
rs2.open "update [user] set newmail=newmail-1 where id="&session("xyluserid")&"",conn,1,3
set rs2=nothing
end if
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
end if%>
<table width="90%" align="center" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" class="border">
<tr>
<td height="25" bgcolor="#f9f8f2"><div align="center"><%=obj.showpage(strFileName,totalput,MaxPerPage,true,true,"条",currentPage)%></div></td>
</tr>
</table> <br>
<%rs.close
set rs=nothing
end sub
sub add%>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="2" class="border">
<form name="mailadd" method="post" action="?type2=add2">
<tr bgcolor="#F7F7F7">
<td width="11%" height="20"> </td>
<td width="89%">新建邮件</td>
</tr>
<tr>
<td height="20">发送给:</td>
<td><input name="toid" type="text" class="formtext" id="toid" value="<%=request("toid")%>" maxlength="20">
填写对方ID,ID查看请到“<a href="xy.asp">校友</a>”栏目中查看。</td>
</tr>
<tr>
<td height="20">邮件标题:</td>
<td valign="top"><input name="mailtitle" type="text" class="formtext2" id="mailtitle" maxlength="30"> </td>
</tr>
<tr valign="top">
<td height="20">邮件内容:</td>
<td><textarea name="content" cols="50" rows="7" id="content"></textarea></td>
</tr>
<tr valign="top">
<td height="20"> </td>
<td><input name="Submit" type="submit" class="bottom" value="发送"></td>
</tr></form>
</table>
<br>
<%end sub
sub add2
toid=obj.HtmlEncode(request.form("toid"))
title=obj.HtmlEncode(request.form("mailtitle"))
content=obj.HtmlEncode(request.form("content"))
if toid="" or title="" or content="" then ShowError("缺少参数!")
rs.open "select * from mail where 1=2",conn,1,3
rs.addnew
rs("toid")=toid
rs("title")=title
rs("date")=now
rs("content")=content
rs("fromid")=session("xyluserid")
rs("isread")=0
rs.update
rs.close
rs.open "update [user] set newmail=newmail+1 where id="&toid&"",conn,1,3
set rs=nothing
a=obj.gourl(" 页面三秒后将自动返回邮箱列表,可以继续选择以下操作:<br><br> 返回<A href='mail.asp?type2=add'>[再发一封]</a><br><br> 到<A href='mail.asp'>[邮箱列表]</a>","mail.asp")
end sub
sub del
id=clng(obj.regstr(request("id")))
if id="" or id<1 then ShowError("缺少必要的参数")
rs.open "select * from mail where id="&id&"",conn,1,3
if rs.eof then ShowError("不存在")
if rs("toid")=session("xyluserid") then
rs.close
rs.open "delete from mail where id="&id&"",conn,1,3
set rs=nothing
a=obj.gourl(" 页面三秒后将自动返回邮箱列表,可以继续选择以下操作:<br><br> 到<A href='index.asp'>[到网站首页]</a><br><br> 返回<A href='mail.asp'>[邮箱列表]</a>","mail.asp")
else
ShowError("你无权限操作!")
end if
end sub%>
</td></tr>
</table>
<%sitebottom%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -