-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_home_page.php
79 lines (59 loc) · 1.81 KB
/
message_home_page.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
<?php
ini_set('display_errors','1');
//here is not use of u variable
//include ('./inc/connect.inc.php');
include ('./inc/header.inc.php');
//for d
include ('./inc/menu.inc.php');
include ('./inc/textfilter.php');
include ("./inc/loggedInUserDetails.php");
include ("./functions/getFriendslist.php");
include ("./functions/time_elapsed.php");
?>
<?php
$queryMsgNotification = "SELECT sender, reciever, date_sent, time_sent FROM messages WHERE reciever = ? ORDER BY msg_id DESC";
$queryMsgNotificationstmt = $conn -> stmt_init();
if($queryMsgNotificationstmt -> prepare($queryMsgNotification))
{
$queryMsgNotificationstmt -> bind_param('s',$username);
$queryMsgNotificationstmt -> execute();
$queryMsgNotificationstmt -> bind_result($senderNoti, $reciverNoti, $date_sent_noti, $time_sent_noti);
// $queryMsgNotificationstmt -> store_result();
$numOfMsg = $queryMsgNotificationstmt -> num_rows;
}
else {
$msgnotierror = $queryMsgNotificationstmt -> error;
die("$msgnotierror");
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Messages</title>
</head>
<body>
<br>
<h3>You have <?=$numOfMsg ?> messages.</h3>
<?php
$numOfMsg = 0;
$senderrepetitionCheck = "";
// $arr = $queryMsgNotificationstmt -> fetch();
while($queryMsgNotificationstmt -> fetch())
{
// print_r($senderNoti);
if($senderrepetitionCheck == $senderNoti)
{
continue;
}
$numOfMsg += 1;
$daysMessagedAgo = time_elapsed($date_sent_noti);
?>
<p><a href="message_specific_person.php?u=<?=$senderNoti ?>"><?=$senderNoti ?> </a> messaged you on <?=$date_sent_noti." at ".$time_sent_noti." --- ".$daysMessagedAgo ?></p>
<?php
$senderrepetitionCheck = $senderNoti;
}
$queryMsgNotificationstmt -> free_result();
?>
</body>
</html>