-
Notifications
You must be signed in to change notification settings - Fork 10
/
hatInput.php
65 lines (64 loc) 路 2.8 KB
/
hatInput.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
include "conn.php";
include "auth.php";
if(isset($_SESSION['room']))
{
$room = $_SESSION['room'];
// $findSql = "SHOW TABLES FROM epiz_27865341_user";
$findSql = "SHOW TABLES FROM user";
$result = mysqli_query($conn, $findSql);
if(mysqli_num_rows($result)>0)
{
while($data = mysqli_fetch_assoc($result))
{
// $table = $data['Tables_in_epiz_27865341_user'];
$table = $data['Tables_in_user'];
$removeMe = str_replace($username, "", $table);
$ifMe = str_replace($removeMe, "", $table);
$finalName = str_replace($username, "", $table);
if($table != "login" && $table != "dp" && $table != "profile" && $table != "username" && $ifMe == $username)
{
$last = "SELECT * FROM `$table` WHERE sn = ( SELECT MAX( sn ) FROM `$table` )";
$lastResult = mysqli_query($conn, $last);
if(mysqli_num_rows($lastResult)>0)
{
$lastData = mysqli_fetch_array($lastResult);
$readMsg = $lastData['msg'];
}
else{
if($finalName == "bot")
{
$readMsg = "How may I help you?";
}
else{
$readMsg = "You added $finalName";
}
}
$getImg ="SELECT * FROM `dp` WHERE `username` = '$finalName';";
$imgResult = mysqli_query($conn, $getImg);
if(mysqli_num_rows($imgResult)>0) {
$imgData = mysqli_fetch_array($imgResult);
$folder = $imgData['folder'];
}
else
{
$folder = "asset/user.png";
}
echo "
<a href='hatDisplay.php?id=$table' style='text-decoration: none;'>
<li class='contact'>
<div class='wrap'>
<span class='contact-status online'></span>
<img src='$folder' alt='user'/>
<div class='meta'>
<p class='name'>$finalName</p>
<p class='preview'>$readMsg</p>
</div>
</div>
</li>
</a>";
}
}
}
}
?>