-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtwitter_readsentmessage.php
70 lines (44 loc) · 1.27 KB
/
twitter_readsentmessage.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
<?php
/**
* File of miniTwitter
*
* @author Daniel Plewinski
* @author email: [email protected]
* @link https://github.com/daniel-plewinski/miniTwitter
*/
session_start();
ob_start();
if(!isset($_SESSION["userID"])){
header("location: twitter_login.php");
die();
}
include 'config.php';
include 'src/User.php';
include 'src/Comment.php';
include 'src/Tweet.php';
include 'src/Message.php';
include 'template/header.php';
?>
<div class="container">
<?php
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$messageId = $_GET['message_id'];
$messageAr = Message::showMessageById($conn, $messageId);
$toUserName = User::getUsernameByID($conn, $messageAr[0]['to_id']);
if ($messageAr[0]['from_id'] != $_SESSION['userID']) {
echo "Nie masz uprawnień żeby czytać tę wiadomość";
} else {
echo "<i>Wiadomość do <strong>$toUserName</strong> wysłana w dniu " . $messageAr[0]['message_date'] . "</i><br>";
echo "<h4>" . $messageAr[0]['content'] . "</h4>";
echo "Status: ";
if ($messageAr[0]['is_read'] == 0) {
echo "Nieprzeczytana";
} else {
echo "Przeczytana";
}
}
}
?>
</div>
</body>
</html>