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

📄 user_showpermsg.asp

📁 WAP网上购物系统源程序,,有兴趣的朋友,一起研究一下..交流经眼
💻 ASP
字号:
<!--#include file=INC/skin.asp-->

<%
dim const_txl_HomeUrl,errstr,txl_username,txl_password,i,page,tmpstr
dim GBL_CHK_TempStr,txlloginerrstr,login_username,login_truename,msgid
msgid=Request.QueryString("msgid")
login_username=Session("username")
If login_username="" Then 
	Call SiteHead2 (const_txlname&"-信箱")
	Response.write "<center><font style='font-size:12px;color:red' ><br><br>还没有登录或连接会话超时,请先登录!<br><a href=javascript:window.close()>[关闭窗口]</a></font></center>"
	Call web_end2

	Response.End
End If
GBL_CHK_TempStr=""
errstr=""
const_txl_HomeUrl=""
OpenDatabase
login_truename=getmasterusername(login_username) 
SiteHead2 const_txlname&"-"&login_truename&"的短信箱"
call online
Select Case Request.QueryString("action")
	Case "showsendmsgfrm":
		Call showsendmsgfrm
	Case "showmeginfo":
		Call showmeginfo
	Case "savemsgsend":
		Call savemsgsend

	Case "delmsg":
		Call delmsg(Request.QueryString("msgid"))
	Case Else:
		Call main
End Select 
CloseDatabase
Call web_end2
Sub main
	Dim rs,sql,pagesize2,ordercount,curpage,orderpagecount
	Dim displaypagenum,bgcolor,basebgcolor,title
	sql="select * from permsg where towho='"&login_username&"' order by isread asc,id desc"
	set rs=Server.CreateObject("Adodb.Recordset")
	rs.open sql,conn,1
	displaypagenum=4
	pagesize2=7
	rs.pagesize=pagesize2
	ordercount=rs.recordcount
	curpage=Request.QueryString("page")
	if curpage="" then curpage=1
	orderpagecount=rs.pagecount
%>
  <table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
  <td colspan="5" bgcolor="#FFFFFF"><font color="gray">(注:粗体表示尚未读信息)</font></td>
  </tr>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td width="28" class="blu">编号</td>
      <td width="181" class="blu">主题</td>
      <td width="95" class="blu">发送者 </td>
      <td width="151" class="blu">发送时间 </td>
      <td width="29" class="blu">删</td>
    </tr>
	<%
		if not rs.eof then
			 rs.absolutePage=curpage
			i=0
			basebgcolor="#F6F4F8"
		While not rs.eof and i<pagesize2
			i=i+1
			if i mod 2=0 then
				bgcolor="#f1f1f1"
			else
				bgcolor="#ffffff"
			end if
			title=rs("title")
			If len(title)>14 then title=left(title,12)&"…"
			if rs("isread")= 0 then title="<B><font title='点击查看详情,未读'>"&title&"</font></B>"
	%>
    <tr align="center" bgcolor="<%=bgcolor%>" onMouseOver="this.bgColor='#f1f1f1'" onMouseOut="this.bgColor='<%=bgcolor%>'"> 
      <td><B><%=i%></B></td>
      <td><a href='?action=showmeginfo&msgid=<%=rs("id")%>'  title="点击查看详情,已读"><%=title%></a></td>
      <td><%=rs("username")%></td>
      <td><%=rs("adddate")%></td>
      <td><a href='?action=delmsg&msgid=<%=rs("id")%>' onclick="return confirm('你确实要删除这条信息吗?');return false;" title="删除信息">删</a></td>
    </tr>
	<%
			rs.movenext
		Wend
		End if
	%>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td colspan="5">
	  <%=ShowPage (orderpagecount,orderCount,curPage,PageSize2,"?",displaypagenum)
%></td>
    </tr>
  </table>
  <br><div align="center">
  <a href="?action=showsendmsgfrm" title="发送消息">给别人发送消息</a>&nbsp;&nbsp;
  <a href="javascript:window.location.reload()" title="刷新">刷新</a>&nbsp;&nbsp;
  <a href="javascript:window.close()" title="关闭窗口">【关闭窗口】</a>&nbsp;&nbsp;
<a href="?action=delmsg&msgid=all" title="清空收件箱" onclick="return confirm('你确实要清空收件箱吗?')">清空我的收件箱</a></div>
<%
	rs.close
	set rs=nothing
End Sub
%>
<%
function web_end2
	Response.Write "<a name=bottom></a>"&vbcrlf
	Response.Write "<table width='98%' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#ffffff'>"&vbcrlf
  	Response.Write "	<tr>"&vbcrlf 
	Response.Write "		<td height=8 background='"&const_txl_HomeUrl&"images/nevb.gif'></td>"&vbcrlf
  	Response.Write "	</tr>"&vbcrlf
  	Response.Write "	<tr>"&vbcrlf 
   	Response.Write "		<td  style='border:#e6e6e6 1px solid;font-size:12px;text-align:center;line-height:1.8;'>"&vbcrlf
    Response.Write 			const_copyright&vbcrlf
    Response.Write 			"<br>"&vbcrlf
    Response.Write "		Copyright &copy;2003 <a href='http://www.81238.net' target='_blank'><font face=Verdana, Arial, Helvetica, sans-serif style=font-size:10px><b>南昌航院<font color=#CC0000>040942班</font></b></font></a>  Powered by :<a href=http://www.81238.net/class2 target=_blank title='???'><font color=gray style='text-DECORATION: none'> V2.0</font></a>"&vbcrlf
 	Response.Write " 		页面执行时间:" & fix(abs(CDBL(Timer)*1000 - DEF_PageExeTime1)) & "ms"&vbcrlf
    Response.Write "		</td>"&vbcrlf
  	Response.Write "	</tr>"&vbcrlf
	Response.Write "</table>"&vbcrlf
	Response.Write "</BODY>"&vbcrlf
	Response.Write "</HTML>"&vbcrlf
end function
sub showsendmsgfrm
%>
<script language="JavaScript">
function check_form_jing_walk(jing_walk_frm){
	if(jing_walk_frm.frm_receiver.value==""){
		alert("必须填写收信人");
		jing_walk_frm.frm_receiver.focus();
		return false
	}
	if (jing_walk_frm.frm_title.value==""){
		alert("必须填写信息标题");
		jing_walk_frm.frm_title.focus();
		return false
	}
	if (jing_walk_frm.frm_content.value==""){
		alert("必须填写信息内容");
		jing_walk_frm.frm_content.focus();
		return false
	}
	if (jing_walk_frm.frm_content.value.length>800){
		alert("字数超过限制!当前字数为"+jing_walk_frm.frm_content.value.length);
		jing_walk_frm.frm_content.focus();
		return false
	}
return true
}
</script>
<form action="?action=savemsgsend" method="post" name="form_jing_walk" id="form_jing_walk" onSubmit="return check_form_jing_walk(this)">
  <table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
    <tr bgcolor="#B1BDD6"> 
      <td colspan="2" class="blu">==发短信==</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td class="tar">发送者</td>
      <td width="378"><%=login_username%> </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td class="tar">*接收人</td>
      <td><input name="frm_receiver" type="text" id="frm_receiver" size="20" maxlength="50" value="<%=Request.QueryString("towho")%>">
        &nbsp;
        <select name="select" onChange="document.form_jing_walk.frm_receiver.value=this.value">
          <option selected value="">==选择接收人==</option>
		  <%Call showallreceiver%>
        </select>
	  </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td class="tar">*信息标题</td>
      <td><input name="frm_title" type="text" id="frm_title" size="30" maxlength="50"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td class="tar">内容(备注)<br>
        <font color="gray">(HTML 不支持<br>
        UBB 不支持</font> <br>
        <font color="gray">字数小于800)</font> </td>
      <td><textarea name="frm_content" cols="50" rows="6" id="frm_content"></textarea></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="99">&nbsp;</td>
      <td> <input type="submit" name="Submit" value="提交">
        &nbsp;&nbsp; 
        <input type="reset" name="Submit2" value="重置">
		&nbsp;&nbsp; 
        <input type="button" onclick="javascript:window.location.href='?'" value="返回">
        &nbsp;&nbsp; <input name="button" type="button" onclick="javascript:window.close()" value="关闭窗口"> 
      </td>
    </tr>
  </table>
</form>
<%End sub%>
<%Sub showallreceiver
	dim rs
	set rs=conn.execute ("select studentid,sname from ec order by studentid asc")
	while not rs.eof
		Response.Write("<option value='"&rs(0)&"'>"&rs(1)&"</option>"&Vbcrlf)
		rs.movenext
	wend
	rs.close
	set rs=nothing
End Sub%>
<%Sub showmeginfo
	Dim id,rs
	id=msgid
	if not isnumeric(id) then
		Response.write "<center><font style='font-size:12px;color=red' ><br><br>传递非法参数!</font></center>"
		Exit Sub
	end if
	set rs=conn.execute ("select * from permsg where id="&id&" and towho='"&login_username&"'")
	If not rs.eof Then
		conn.execute ("update permsg set isread=1 where id="&id)
%>
<br>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  <tr bgcolor="#B1BDD6"> 
    <td colspan="2" class="blu">
	<B><font color="#FFFFFF">==查看短信==&nbsp;&nbsp;&nbsp;&nbsp;</font></B>
</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td width="88" class="tar">发信人</td>
    <td width="405" class="content"><%=rs("username")&"-"&getmasterusername(rs("username"))%></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td class="tar">信息标题</td>
    <td class="content"><%=rs("title")%></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td class="tar">内容(备注)
    </td>
    <td class="content"><%=rs("content")%></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td colspan="2" align="center"><input type="button" name="Submit3" value="返回" onclick="javascript:window.history.back()">        <a href="?action=showsendmsgfrm&towho=<%=rs("username")%>" title="回复信息" style="color:#FF0000">回复</a>   
      <a href="?action=delmsg&msgid=<%=rs("id")%>" title="删除该条信息" onClick="return confirm('确实要删除这个信息?')" style="color:#FF0000">删除</a> </td>
  </tr>
</table>
<br>
<%
	End If
	rs.close
	set rs=nothing
End Sub
%>
<%
Rem 保存发信!
Sub savemsgsend
	dim title,towho,content,sql,tmpstr
	if outsitesubmit then
		printerror "发送短信息失败","<li>请不要外部提交数据!</li>","97%"
		exit sub
	end if
	towho=Replace(Request.Form("frm_receiver"),"'","''")
	If towho=login_username Then
		Call printerror("发送短信息失败","<li><font color='red'>好像没必要给自己发短信吧!</font></li><li>回<a href='?'>我的信箱</a></li>","97%")
		Exit Sub
	End If
	if getmasterusername(towho)=""	Then
		Call printerror("发送短信息失败","<li>不存在<font color='red'>"&towho&"</font>的用户</li><li>回<a href='?'>我的信箱</a></li>","97%")
		Exit Sub
	End If
	title=Replace(Request.Form("frm_title"),"'","''")
	content=Replace(Request.Form("frm_content"),"'","''")
	title=HtmlEncode_walk(title)
	content=HtmlEncode_walk(content)
	If content="" or title="" Then
		printerror "发送短信息失败","<li>请输入标题和内容!</li><li>回<a href='?'>我的信箱</a></li>","97%"
		exit sub
	End If
	sql="insert into permsg(username,towho,title,content,adddate,isread)values('"
	sql=sql&login_username&"','"&towho&"','"&title&"','"&content&"','"&now()&"',0)"
	conn.execute sql
	tmpstr="<li>发送给"&towho&"的信息已成功送出!</li>"
	tmpstr=tmpstr&"<li>回<a href='?'>我的信箱</a></li>"
	Call printsuc("发送短信息成功",tmpstr,"97%")
End Sub

Rem 删除信息!
Sub delmsg(msgid)
	dim id,rs
	id=msgid
	if not isnumeric(id) then
		if id<>"all" or id="" then
			printerror "删除短信息失败","<li>参数非法!</li><li>回<a href='?'>我的信箱</a></li>","97%"
		exit sub
		else
			'删除全部,应该给出提示
			If Request("queren")<>"true" Then
				Response.write "<div align=center><br><font color=red>本操作正在清空你的信箱,且不可恢复。你确实要进行该操作吗?<br>请点击下面的“确定”按钮继续执行操作,点击“取消”来撤消本次操作。</font><br><br>"
				Response.write "<input type=button value='确定' onclick=""javascript:window.location.href='?action=delmsg&msgid=all&queren=true'"">&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='取消' onclick='javascript:history.back()'><br><br></div>"
			Else
				'删除全部
				conn.Execute ("delete from permsg where towho='"&login_username&"'")	
				tmpstr="<li>已经成功清空信箱!</li>"
				tmpstr=tmpstr&"<li>回<a href='?'>我的信箱</a></li>"
				Call	printsuc("清空信箱成功!",tmpstr,"97%")
			End IF
		end if
	else
		set rs=conn.execute ("select towho from permsg where id="&id)
		if rs.eof then
			printerror "删除短信息失败","<li>不存在标号为"&id&"的短信息!</li><li>回<a href='?'>我的信箱</a></li>","97%"
			exit sub
		else
			if rs(0)<>login_username Then
				printerror "删除短信息失败","<li>越权操作!</li><li>回<a href='?'>我的信箱</a></li>","97%"
				exit sub
			else
				conn.execute ("delete from permsg where id="&id)
				tmpstr="<li>已经成功删除标号为<font color='red'>"&id&"</font>的短信息!</li>"
				tmpstr=tmpstr&"<li>回<a href='?'>我的信箱</a></li>"
				Call	printsuc("清空信箱成功!",tmpstr,"97%")
			end if
		end if
		rs.close
		set rs=nothing
	end if
End Sub
%>

⌨️ 快捷键说明

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