-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_refreshrecentareaprocess.php
109 lines (87 loc) · 3.67 KB
/
admin_refreshrecentareaprocess.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
session_start();
require "connection.php";
if (isset($_SESSION["a"])) {
$mail = $_SESSION["a"]["email"];
$chatrs = Database::search("SELECT * FROM `chat` WHERE `from` NOT IN ('" . $mail . "') AND `to`='".$mail."' ORDER BY `date` DESC LIMIT 1");
$n = $chatrs->num_rows;
for ($x = 0; $x < $n; $x++) {
$r = $chatrs->fetch_assoc();
$u = array_unique($r);
?>
<a class="list-group-item list-group-item-action active text-white rounded-0">
<div class="media">
<?php
$profileimg = Database::search("SELECT * FROM `profile_img` WHERE `user_email`='" . $r["from"] . "' ");
$img = $profileimg->num_rows;
if ($img == 1) {
$code = $profileimg->fetch_assoc();
?>
<img src="<?php echo $code["code"]; ?>" width="50" class="rounded-circle" />
<?php
} else {
?>
<img src="resources/demoProfileImg.jpg" width="50" class="rounded-circle">
<?php
}
?>
<div class="media-body ml-4">
<div class="d-flex align-items-center justify-content-between mb-1">
<h6 class="mb-0"><?php echo $u["from"]; ?></h6><small class="small font-weight-bold">
<?php
$rd = $u["date"];
$spliterd = explode(" ", $rd);
$d = explode("-", $spliterd[0]);
echo $d[1]; ?>-<?php echo $d[2];
?>
</small>
</div>
<p class="font-italic mb-0 text-small"><?php echo $u["content"]; ?></p>
</div>
</div>
</a>
<?php
}
}else if (isset($_SESSION["u"])) {
$mail = $_SESSION["u"]["email"];
$chatrs = Database::search("SELECT * FROM `chat` WHERE `from` NOT IN ('" . $mail . "') ORDER BY `date` DESC LIMIT 1");
$n = $chatrs->num_rows;
for ($x = 0; $x < $n; $x++) {
$r = $chatrs->fetch_assoc();
$u = array_unique($r);
?>
<a class="list-group-item list-group-item-action active text-white rounded-0">
<div class="media">
<?php
$profileimg = Database::search("SELECT * FROM `profile_img` WHERE `user_email`='" . $r["from"] . "' ");
$img = $profileimg->num_rows;
if ($img == 1) {
$code = $profileimg->fetch_assoc();
?>
<img src="<?php echo $code["code"]; ?>" width="50" class="rounded-circle" />
<?php
} else {
?>
<img src="resources/demoProfileImg.jpg" width="50" class="rounded-circle">
<?php
}
?>
<div class="media-body ml-4">
<div class="d-flex align-items-center justify-content-between mb-1">
<h6 class="mb-0"><?php echo $u["from"]; ?></h6><small class="small font-weight-bold">
<?php
$rd = $u["date"];
$spliterd = explode(" ", $rd);
$d = explode("-", $spliterd[0]);
echo $d[1]; ?>-<?php echo $d[2];
?>
</small>
</div>
<p class="font-italic mb-0 text-small"><?php echo $u["content"]; ?></p>
</div>
</div>
</a>
<?php
}
}
?>