-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrooms.php
31 lines (31 loc) · 1.29 KB
/
rooms.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
<div class="padding-container">
<h2>Rooms</h2>
<div class="search">
<i class="material-icons">search</i>
<input type="search" name="search-rooms" id="search-rooms" placeholder="search for rooms that you are a member in" />
</div>
<div class="members-container">
<?php
$pdo = new PDO('mysql:host=localhost;dbname=users', 'root', 'pwd');
$query = $pdo->prepare("select * from rooms");
$query->execute();
$my_email = openssl_decrypt($_SESSION['token'], "AES-128-CTR", "11112000", 0, "1234567890123456");
while ($result = $query->fetch(PDO::FETCH_ASSOC)) {
$q = $pdo->prepare("select * from rooms_members where id_room=?");
$q->bindValue(1,$result['id']);
$q->execute();
$b = true;
while($r = $q->fetch(PDO::FETCH_ASSOC) and $b) {
if($r['email']==$my_email) $b = false;
}
if(!$b) echo "<a href='dashbord.php?show=message&with=r".$result['id']."' class='member'>
<i class='material-icons'>assignment_ind</i>
<span class='member-name'>". $result['room_name']."</span>
</a>";
}
?>
</div>
<a href="add_room.php" class="add-room-btn">
<i class="material-icons">add</i>
</a>
</div>