<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="checkbbsuser.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%@ include file="../inc/ftbbstohtml.jsp"%>
<%!String searchstr,smtype;%>
<%
String str,img,touxian,jibie,sqlsms,chstr,ku,ka;
int tili,jingyuan;
ResultSet rs1,rs2,rs3;
String bbsadmin=(String)session.getAttribute("bbsadmin");
username=(String)session.getAttribute("name");
String act=request.getParameter("act");
if(act!=null){
searchstr=new String(request.getParameter("searchstr").getBytes("iso-8859-1"));
smtype=request.getParameter("smtype");
}
String t=request.getParameter("t");
String sql="select * from sms where bbssystem=1 order by indate desc";
ResultSet rs=stmt.executeQuery(sql);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/xmwuye.css" rel=stylesheet type=text/css>
<title><%=session.getAttribute("name")%>的收件箱</title>
</head>

<body topmargin="5">
<div align="center"> 
  <TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width="99%">
    <TR> 
      <TD height=25> <div align="center"><font color="#FFFFFF"><strong>欢迎<font color="#CC3300"><%=session.getAttribute("name")%></font>网友来管理你的论坛短信</strong></font></div></TD>
    </TR>
  </TABLE>
  <TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width="99%">
    <TR> 
      <TD height=28 bgcolor="#e8f5ff"> 
        <div align="center"> 
          <form name="form1" method="post" action="" style="MARGIN-BOTTOM: 0px">
            短信搜索: 
            <input name="searchstr" type="text" id="searchstr" size="25">
            <select name="smtype" id="smtype">
              <option value="title" selected>短信标题</option>
              <option value="content">短信内容</option>
            </select>
            <input name="act" type="hidden" id="act" value="y">
            <input type="submit" name="Submit" value="查找短信">
            <input name="button" type="button" id="button" value="发送短信" onClick="javascript:window.location.href='postsms.jsp'">
            <input name="send" type="button" id="send" value="收件箱" onClick="javascript:window.location.href='mysms.jsp'">
            <input name="re" type="button" id="re" value="发件箱" onClick="javascript:window.location.href='mysms.jsp?t=my'">
          </form>
          <font color="#FFFFFF"></font></div></TD>
    </TR>
  </TABLE>
<%
if(t==null&&rs.next()){
%>
<table border="0" width="99%" cellspacing="0" cellpadding="0" bgcolor="#A4B6D7" align="center">
    <tr bgcolor="#b1d6fa">
      <td height="23" valign="middle"> 
        <div align="center"><b>系统信息</b></div></td>
      <td class="new14"><b>标 题：<%=rs.getString("title")%></b></td>
    </tr>
    <tr bgcolor="#f3f5ff">
      <td valign="top" width="20%" bgcolor="#e8f5FF"><div align="center">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td><div align="center"> <IMG height=84 src=../bbs/userheadimg/cache5.gif width=84></div></td>
            </tr>
            <tr> 
              <td height="20"><div align="center">系统管理员</div></td>
            </tr>
            <tr> 
              <td height="12">&nbsp;</td>
            </tr>
          </table>
        </div></td>
      <td valign="top" bgcolor="#f6f6f6"><table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr>
            <td height="80" valign="top" class="new14"> <%=htmln(rs.getString("content"))%></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="5" cellpadding="0">
          <tr>
            <td height="1" background="../bbs/userheadimg/bg_text1.gif"></td>
          </tr>
          <tr>
            <td height="18">
<table width="100%" border=0 cellspacing=0 cellpadding=0>
                <tr>
                  <td width="55%" class=new14><font color="#000000"> 
                    <%if(bbsadmin.equals("1")){%>
                    操作选项：[<a class=a03 href=delsms.jsp?id=<%=rs.getString("id")%>>删除</a>][<a class=a03 href=editsms.jsp?id=<%=rs.getString("id")%>>编辑</a>] 
                    <%}%>
                    </font></td>
                  <td width="45%"><div align="right">发信时间:<%=rs.getString("indate").substring(0,10)%>&nbsp;</div></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
<%}%>
<%
str="select * from sms where bbssystem=2 and accepter='"+session.getAttribute("name")+"' order by indate desc";
Statement stmt1=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs1=stmt1.executeQuery(str);
if(rs1.next()&&t==null){
%>
<table border="0" width="99%" cellspacing="0" cellpadding="0" bgcolor="#A4B6D7" align="center">
    <tr bgcolor="#b1d6fa">
      <td height="23" valign="middle"> 
        <div align="center"><b>系统信息</b></div></td>
      <td class="new14"><b>标 题：<%=rs1.getString("title")%></b></td>
    </tr>
    <tr bgcolor="#f3f5ff">
      <td valign="top" width="20%" bgcolor="#e8f5FF"><div align="center">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td><div align="center"> <IMG height=84 src=../bbs/userheadimg/cache5.gif width=84></div></td>
            </tr>
            <tr> 
              <td height="20"><div align="center">系统管理员</div></td>
            </tr>
            <tr> 
              <td height="12">&nbsp;</td>
            </tr>
          </table>
        </div></td>
      <td valign="top" bgcolor="#f6f6f6"><table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr>
            <td height="80" valign="top" class="new14"> <%=htmln(rs1.getString("content"))%></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="5" cellpadding="0">
          <tr>
            <td height="1" background="../bbs/userheadimg/bg_text1.gif"></td>
          </tr>
          <tr>
            <td><table width="100%" border=0 cellspacing=0 cellpadding=0>
                <tr>
                  <td width="56%" class=new14><font color="#000000"> 
                    <%if(bbsadmin.equals("1")){%>
                    操作选项：[<a class=a03 href=delsms.jsp?id=<%=rs1.getString("id")%>>删除</a>][<a class=a03 href=editsms.jsp?id=<%=rs1.getString("id")%>>编辑</a>] 
                    <%}%>
                    <%if(rs1.getString("sender")!=null){%>[<a class=a03 href="agree.jsp?id=<%=rs1.getString("id")%>&postuser=<%=rs1.getString("sender")%>&accepter=<%=rs1.getString("accepter")%>&agree=Y">同意</a>][<a class=a03 href="disagree.jsp?id=<%=rs1.getString("id")%>&postuser=<%=rs1.getString("sender")%>&accepter=<%=rs1.getString("accepter")%>&agree=N">不同意</a>]<%}%>
                    </font></td>
                  <td width="44%"><div align="right">发信时间:<%=rs1.getString("indate").substring(0,10)%>&nbsp;</div></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
<%
}
%>
<%
if(t!=null){
ku="sender='"+username+"'";
}
else{
ku="accepter='"+username+"'";
}

if(smtype!=null&&searchstr!=null){
   sqlsms="select * from sms where "+ku+" and "+smtype+" like '%"+searchstr+"%' and bbssystem=0 order by indate desc";
}
else{
sqlsms="select * from sms where "+ku+" and bbssystem=0 order by indate desc";
}
//out.print(sqlsms);
//out.close();
ResultSet rs15=stmt1.executeQuery(sqlsms);
int i=1;
while(rs15.next()){ 
String replysign=rs15.getString("replysign");

if(t!=null){
str="select * from clubuser where clubuser_name='"+session.getAttribute("name")+"'";
}
else{
str="select * from clubuser where clubuser_name='"+rs15.getString("sender")+"'";
}
//str="select * from clubuser where clubuser_name='"+rs15.getString("sender")+"'";
//out.print(str);
Statement stmt5=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs5=stmt5.executeQuery(str);
rs5.next();
String clubuser_nickname=rs5.getString("clubuser_nickname");
%>
<TABLE align="center" bgColor="#a4b6d7" border=0 cellPadding=0 cellSpacing=0 width="99%">
    <TBODY>
      <TR bgColor=#f2f8ff> 
        <TD width="20%" height="23" vAlign=middle bgColor=#b1d6fa class=font10_5><div align="center">第<%=i%>条</div></TD>
        <TD bgColor=#b1d6fa class=new14><B> 标 题：<%=rs15.getString("title")%></B> </TD>
      </TR>
    </TBODY>
  </TABLE>
  <TABLE width="99%" border=0 align="center" cellPadding=0 cellSpacing=0 bgColor="#FFFFFF">
    <TBODY>
      <TR bgColor=#f2f8ff>
        <TD bgColor=#e8f5ff class=font10_5 rowSpan=2 vAlign=top width="20%"><DIV align=center>
            <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
                <TR>
                  <TD><div align="center"><IMG height=84 src="../bbs/userheadimg/cache5.gif" width=84></div></TD>
                </TR>
                <TR> 
                  <TD height=20>·网名：<%=clubuser_nickname%></TD>
                </TR>
                <TR> 
                  <TD height=20>·注册：<%=rs5.getString("clubuser_reg_date").substring(0,10)%></TD>
                </TR>
              </TBODY>
            </TABLE>
          </DIV></TD>
      </TR>
      <TR bgColor=#f2f8ff>
        <TD bgColor=#f6f6f6 class=new14 vAlign=top><TABLE border=0 cellPadding=3 cellSpacing=3 width="100%">
            <TBODY>
              <TR>
                <TD height="160" vAlign=top class=new14><%=htmln(rs15.getString("content"))%></TD>
              </TR>
            </TBODY>
          </TABLE>
          <TABLE border=0 cellPadding=0 cellSpacing=5 width="100%">
            <TBODY>
              <TR>
                <TD background="../bbs/images/bg_text1.gif" height="1"></TD>
              </TR>
              <TR>
                <TD align=left class=new14><table width="100%" border=0 cellspacing=0 cellpadding=0>
                    <tr>
                      <td width="56%" class=new14>&nbsp;<font color="#000000">操作选项：[<a class=a03 href=delsms.jsp?id=<%=rs15.getString("id")%>>删除</a>][<a class=a03 href=editsms.jsp?id=<%=rs15.getString("id")%>>编辑</a>][<%if(replysign.equals("0")){%><a class=a03 href=replysms.jsp?id=<%=rs15.getString("id")%>&touser=<%=rs5.getString("clubuser_name")%>>回复</a><%}else{%><font color="#FF0000">已回复</font><%}%>]</font></td>
                      <td width="44%"><div align="right">发信时间:&nbsp;<%=rs15.getString("indate").substring(0,10)%>&nbsp;</div></td>
                    </tr>
                  </table></TD>
              </TR>
            </TBODY>
          </TABLE></TD>
      </TR>
    </TBODY>
  </TABLE> 
<%
i=i+1;
}
%>
  <script language="JavaScript" src="../inc/bbstail.js"></script>
</div>
</body>
</html>