-
Notifications
You must be signed in to change notification settings - Fork 0
/
FromAdminMsgProcess1.php
68 lines (51 loc) · 1.87 KB
/
FromAdminMsgProcess1.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
66
67
68
<?php
session_start();
require "connection.php";
$admin = 'malindu2003@gmail.com';
$user = $_POST["e"];
$msg_rs = Database::search("SELECT * FROM chat WHERE chat.`to`='" . $user . "' AND `from`='" . $admin . "'
OR chat.`from`='" . $user . "' AND `to`='" . $admin . "' ORDER BY chat.id ASC");
$msg_num = $msg_rs->num_rows;
for ($y = 0; $y < $msg_num; $y++) {
$msg_data = $msg_rs->fetch_assoc();
if ($msg_data["from"] == $admin) {
?>
<!-- received -->
<div class="col-12 mt-2">
<div class=" row">
<div class="col-8 rounded bg-success">
<div class="row">
<div class="col-12 pt-2 mt-1">
<span class="text-white fw-bold fs-4"><?php echo $msg_data["content"] ?></span>
</div>
<div class="col-12 text-end pb-2">
<span class="text-white fs-6"><?php echo $msg_data["date_time"] ?></span>
</div>
</div>
</div>
</div>
</div>
<!-- received -->
<?php
} else {
?>
<!-- sent -->
<div class="col-12 mt-2">
<div class=" row">
<div class="offset-4 col-8 rounded bg-primary">
<div class="row">
<div class="col-12 pt-2">
<span class="text-white fw-bold fs-4"><?php echo $msg_data["content"] ?></span>
</div>
<div class="col-12 text-end pb-2">
<span class="text-white fs-6"><?php echo $msg_data["date_time"] ?></span>
</div>
</div>
</div>
</div>
</div>
<!-- sent -->
<?php
}
}
?>