-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.php
41 lines (33 loc) · 1.51 KB
/
chat.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
<?php
require_once("./php/htmlHelper.php");
require_once("./php/sql.php");
RequireLogin();
GenerateHeader("register.jpg", "Chat", 150);
$pdo = GetPDO();
$ID = GetID();
//PUBLIC CHANNELS
echo "<h3 class=\"ui horizontal header divider\">Public chat</h3>";
$req = $pdo->query('SELECT name FROM ultraverse.channels;');
$publicChannels = $req->fetchAll();
foreach ($publicChannels as $chan) {?>
<div class="ui segment">
<a class="ui blue inverted button" href="/chat/<?= urlencode($chan["name"])?>">Join</a> <i class="ui large circular hashtag icon"></i> <span style="font-size: 25px;position: absolute;top: 22px;"><?=$chan["name"]?></span>
</div>
<?php }
$Friend_user=$pdo->prepare('SELECT `to`FROM `relations` WHERE `fro` =:id');
$Friend_user->execute([
":id" => $ID
]);
$data= $Friend_user->fetchAll(PDO::FETCH_ASSOC);
echo "<h3 class=\"ui horizontal header divider\">Private chat</h3>";
foreach ($data as $t) {
if (GetUserData($t["to"])["enabled"] != 1) {
continue;
}?>
<div class="ui segment">
<a class="ui blue inverted button" href="/chat/<?=$t["to"]?>">Contact</a>
<img style="height:3em;margin-bottom:-1em;margin-right: 0.5em;border-radius: 500rem;" src="/avatars/<?= $t["to"] ?>">
<span style="font-size: 25px;position: absolute;top: 25px;"><?= GetUserData($t["to"])["username"] ?></span>
</div>
<?php } ?>
<?php GenerateFooter(); ?>