-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotificationvisual.php
More file actions
66 lines (55 loc) · 2.07 KB
/
notificationvisual.php
File metadata and controls
66 lines (55 loc) · 2.07 KB
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
<?php
session_start();
if (!isset($_SESSION["user_id"])){
exit("Page ERROR!");
}
?>
<div id="notifications">
<h4 style="font-size:30px;"> Notifications </h4> <button id="clrnoti">Clear all</button>
<?php
require_once("sql_connect.php");
$sql2 = "SELECT * FROM notifications WHERE notification_to='{$_SESSION["user_id"]}' ORDER BY id DESC";
$result2 = $conn->query($sql2);
if(!$result2->num_rows > 0){
exit("No new notification!");
}else{
while ($res = $result2->fetch_assoc()) {
if($res["notification_from"] == ""){
?>
<div class="notif">
<button class="ntrednav" value="<?php echo $res["id"]?>">x</button>
<div class="noti">
<p style="width:50%;"><?php echo $res["message"]?> <br> <?php echo $res["time"]?> </p>
</div>
</div>
<?php
}else{
$sql3 = "SELECT * FROM users WHERE userID='{$_SESSION["user_id"]}'";
$result3 = $conn->query($sql3);
if(!$result3->num_rows > 0){
exit("fATAL ERROR!");
}
$res3 = $result3->fetch_assoc();
?>
<div class="notif">
<button class="ntrednav" value="<?php echo $res["id"]?>">x</button>
<div class="noti">
<?php
if(empty($res3["profileimage"]) || empty($res3["imagetype"])){
?>
<img src="icons/user.png" width="100" height="70" style="left:0;top:0;position: relative;"><p style="width:50%;"><?php echo $res["message"]?> <br> <?php echo $res["time"]?></p>
<?php
}else{
?>
<img src="viewimage.php?image_id=<?php echo $res3["userID"];?>" width="100" height="70" id="inboximg" style="left:0;top:0;position: relative;"><p style="width:50%;"><?php echo $res["message"]?> <br> <?php echo $res["time"]?></p>
<?php
}
?>
</div>
</div>
<?php
}
}
}
?>
</div>