-
Notifications
You must be signed in to change notification settings - Fork 0
/
mychat.php
45 lines (45 loc) · 1.9 KB
/
mychat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<div class="col-lg-4">
<div class="panel panel-default">
<?php
$me=mysqli_query($conn,"select * from chat_member left join chatroom on chatroom.chatroomid=chat_member.chatroomid where chat_member.userid='".$_SESSION['id']."' order by chatroom.date_created desc");
$numme=mysqli_num_rows($me);
?>
<div class="panel-heading"><center><strong>Admin Chatrooms <span class="badge"><?php echo $numme; ?></span></strong></center></div>
<div class="panel-body">
<table width="100%" class="table table-striped table-bordered table-hover" id="myChatRoom">
<thead>
<th>Chat Room Name</th>
<th></th>
</thead>
<tbody>
<?php
$my=mysqli_query($conn,"select * from chat_member left join chatroom on chatroom.chatroomid=chat_member.chatroomid where chat_member.userid='".$_SESSION['id']."' order by chatroom.date_created desc");
while($myrow=mysqli_fetch_array($my)){
$nq=mysqli_query($conn,"select * from chat_member where chatroomid='".$myrow['chatroomid']."'");
?>
<tr>
<td><span class="glyphicon glyphicon-user"></span><span class="badge"><?php echo mysqli_num_rows($nq); ?></span> <a href="chatroom.php?id=<?php echo $myrow['chatroomid']; ?>"><?php echo $myrow['chat_name']; ?></a></td>
<td>
<?php
$memb=mysqli_query($conn,"select * from chatroom where userid='".$_SESSION['id']."' and chatroomid='".$myrow['chatroomid']."'");
if (mysqli_num_rows($memb)>0){
?>
<button type="button" class="btn btn-danger btn-sm delete2" value="<?php echo $myrow['chatroomid']; ?>">Delete</button>
<?php
}
else{
?>
<button type="button" class="btn btn-warning btn-sm leave2" value="<?php echo $myrow['chatroomid']; ?>">Leave</button>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>