加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
list.php 10.46 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
include './includes/common.php';
if($_SESSION['islogin']==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
$sql="select * from User where user = '".$_SESSION['user']."'";
$rs=mysqli_query($conn,$sql);
$res = mysqli_fetch_assoc($rs);
$_SESSION['id'] = $res['id'];
$_SESSION['name'] = $res['name'];
$_SESSION['money'] = $res['money'];
$_SESSION['admin'] = $res['admin'];
$_SESSION['qq'] = $res['qq'];
$_SESSION['zt'] = $res['zt'];
$_SESSION['lts'] = $res['lts'];
$_SESSION['ylts'] = $res['ylts'];
if($res["zt"]=='1'){
exit(sysmsg('当前帐户已被封禁<br/>详情请咨询QQ:'.$admin['qq']."<br/>请后续规范使用!"));
}
?>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>聊天室列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./assets/css/font.css">
<link rel="stylesheet" href="./assets/css/index.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="./assets/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./assets/js/index.js"></script>
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a>
<cite>聊天室列表</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
</a>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body ">
<form class="layui-form layui-col-space5">
<div class="layui-input-inline layui-show-xs-block">
<a class="layui-btn" href="chatadd.php" ><i class="layui-icon"></i>创建聊天室</a>
</div>
</form>
<hr>
</div>
<div class="layui-card-body ">
<table class="layui-table layui-form">
<thead>
<tr>
<th width="50">聊天室ID</th>
<th>聊天室名称</th>
<th>聊天室创建者</th>
<th width="70">聊天室简介</th>
<th width="250">操作</th>
</thead>
<?php
$sql = 'SELECT * FROM `Chat` ORDER BY `msg` DESC';
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// 输出数据
while($row = mysqli_fetch_assoc($result)) {
if($row['zt']=='0'){
if($row['admin']==$_SESSION['id']||$row['gl1']==$_SESSION['id']||$row['gl2']==$_SESSION['id']||$row['gl3']==$_SESSION['id']){
if($row['yn']=='1'){
$sql="select * from User where id = ".$row['admin'];
$rs=mysqli_query($conn,$sql);
$res = mysqli_fetch_assoc($rs);
$sz=$res['name'];
?>
<tbody class="x-cate">
<tr cate-id='<?php echo$row['id']?>' fid='0' >
<td><?php echo$row['id']?></td>
<td><?php echo$row['name']?></td>
<td><?php echo$sz?></td>
<td><?php echo$row['jj']?></td>
<td class="td-manage">
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室','pwd.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>进入</button>
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室后台','chatadmin.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>管理</button>
</td>
</tr>
<?php
}else{
$sql="select * from User where id = ".$row['admin'];
$rs=mysqli_query($conn,$sql);
$res = mysqli_fetch_assoc($rs);
$sz=$res['name'];
?>
<tbody class="x-cate">
<tr cate-id='<?php echo$row['id']?>' fid='0' >
<td><?php echo$row['id']?></td>
<td><?php echo$row['name']?></td>
<td><?php echo$sz?></td>
<td><?php echo$row['jj']?></td>
<td class="td-manage">
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室','chat.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>进入</button>
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室后台','chatadmin.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>管理</button>
</td>
</tr>
<?php
}
}else{
if($row['yn']=='1'){
$sql="select * from User where id = ".$row['admin'];
$rs=mysqli_query($conn,$sql);
$res = mysqli_fetch_assoc($rs);
$sz=$res['name'];
?>
<tbody class="x-cate">
<tr cate-id='<?php echo$row['id']?>' fid='0' >
<td><?php echo$row['id']?></td>
<td><?php echo$row['name']?></td>
<td><?php echo$sz?></td>
<td><?php echo$row['jj']?></td>
<td class="td-manage">
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室','pwd.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>进入</button>
</td>
</tr>
<?php
}else{
$sql="select * from User where id = ".$row['admin'];
$rs=mysqli_query($conn,$sql);
$res = mysqli_fetch_assoc($rs);
$sz=$res['name'];
?>
<tbody class="x-cate">
<tr cate-id='<?php echo$row['id']?>' fid='0' >
<td><?php echo$row['id']?></td>
<td><?php echo$row['name']?></td>
<td><?php echo$sz?></td>
<td><?php echo$row['jj']?></td>
<td class="td-manage">
<button class="layui-btn layui-btn layui-btn-xs" onclick="xadmin.open('聊天室','chat.php?ltsid=<?php echo $row['id'] ?>')" ><i class="layui-icon">&#xe642;</i>进入</button>
</td>
</tr>
<?php
}
}
}
}
} else {
?>
<tbody class="x-cate">
<tr cate-id='9' fid='0' >
<td>暂无</td>
<td>暂无</td>
<td>暂无</td>
<td>暂无</td>
<td class="td-manage">
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="layui-card-body ">
<div class="page">
<div>
<a class="prev" href="">&lt;&lt;</a>
<span class="current">1</span>
<a class="next" href="">&gt;&gt;</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
layui.use(['form'], function(){
form = layui.form;
});
/*用户-删除*/
// 分类展开收起的分类的逻辑
//
$(function(){
$("tbody.x-cate tr[fid!='0']").hide();
// 栏目多级显示效果
$('.x-show').click(function () {
if($(this).attr('status')=='true'){
$(this).html('&#xe625;');
$(this).attr('status','false');
cateId = $(this).parents('tr').attr('cate-id');
$("tbody tr[fid="+cateId+"]").show();
}else{
cateIds = [];
$(this).html('&#xe623;');
$(this).attr('status','true');
cateId = $(this).parents('tr').attr('cate-id');
getCateId(cateId);
for (var i in cateIds) {
$("tbody tr[cate-id="+cateIds[i]+"]").hide().find('.x-show').html('&#xe623;').attr('status','true');
}
}
})
})
var cateIds = [];
function getCateId(cateId) {
$("tbody tr[fid="+cateId+"]").each(function(index, el) {
id = $(el).attr('cate-id');
cateIds.push(id);
getCateId(id);
});
}
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化