<?php
if(!defined('InEmpireCMS'))
{
exit();
}
?>
<?php
$public_diyr['pagetitle']='消息列表';
$url="<a href=../../../>首页</a> > <a href=../cp/>会员中心</a> > 消息列表 (<a href='AddMsg/?enews=AddMsg'>发送消息</a>)";
require(ECMS_PATH.'e/template/incfile/header.php');
?>
<script>
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
<td width="50%" height="30" bgcolor="#FFFFFF"> </td>
<td width="50%" bgcolor="#FFFFFF"><div align="right">[<a href="AddMsg/?enews=AddMsg">发送消息</a>] </div></td>
</tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<form name="listmsg" method="post" action="../doaction.php" onsubmit="return confirm('确认要删除?');">
<tr class="header">
<td width="4%" height="23"> <div align="center"></div></td>
<td width="45%"><div align="center">标题</div></td>
<td width="18%"><div align="center">发送者</div></td>
<td width="23%"><div align="center">发送时间</div></td>
<td width="10%"><div align="center">操作</div></td>
</tr>
<?php
while($r=$empire->fetch($sql))
{
$img="haveread";
if(!$r[haveread])
{$img="nohaveread";}
//后台管理员
if($r['isadmin'])
{
$from_username="<a title='后台管理员'><b>".$r[from_username]."</b></a>";
}
else
{
$from_username="<a href='../ShowInfo/?userid=".$r[from_userid]."' target='_blank'>".$r[from_username]."</a>";
}
//系统信息
if($r['issys'])
{
$from_username="<b>系统消息</b>";
$r[title]="<b>".$r[title]."</b>";
}
?>
<tr bgcolor="#FFFFFF">
<td height="25"> <div align="center">
<input name="mid[]" type="checkbox" id="mid[]2" value="<?=$r[mid]?>">
</div></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9%"><div align="center"><img src="../../data/images/<?=$img?>.gif" border=0></div></td>
<td width="91%"><a href="ViewMsg/?mid=<?=$r[mid]?>">
<?=stripSlashes($r[title])?>
</a></td>
</tr>
</table></td>
<td><div align="center">
<?=$from_username?>
</div></td>
<td><div align="center">
<?=$r[msgtime]?>
</div></td>
<td> <div align="center"> [<a href="../doaction.php?enews=DelMsg&mid=<?=$r[mid]?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
</tr>
<?php
}
?>
<tr bgcolor="#FFFFFF">
<td><div align="center">
<input type=checkbox name=chkall value=on onclick=CheckAll(this.form)>
</div></td>
<td colspan="4"><input type="submit" name="Submit2" value="删除选中">
<input name="enews" type="hidden" value="DelMsg_all"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td><div align="center"></div></td>
<td colspan="4">
<?=$returnpage?> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" colspan="5"><div align="center">说明:<img src="../../data/images/nohaveread.gif" width="14" height="11">
代表未阅读消息,<img src="../../data/images/haveread.gif" width="15" height="12">
代表已阅读消息.</div></td>
</tr>
</form>
</table>
<?php
require(ECMS_PATH.'e/template/incfile/footer.php');
?> 再看就更加明白了:
<?php
require("../../class/connect.php");
require("../../class/q_functions.php");
require("../../class/db_sql.php");
require("../class/user.php");
require "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
eCheckCloseMods('member');//关闭模块
$user=islogin();
$start=0;
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$add='';
$search='';
$line=20;//每行显示
$page_line=10;
$offset=$page*$line;
$totalquery="select count(*) as total from {$dbtbpre}enewsqmsg where to_username='$user[username]'";
$query="select mid,title,haveread,from_userid,from_username,isadmin,msgtime,issys from {$dbtbpre}enewsqmsg where to_username='$user[username]'";
$num=$empire->gettotal($totalquery);
$query.=" order by mid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
//导入模板
require(ECMS_PATH.'e/template/member/msg.php');
db_close();
$empire=null;
?>
|