/
DirectMsgSent.php
36 lines (27 loc) · 930 Bytes
/
DirectMsgSent.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
<?php
/** -_-_- AUTHOR: jAsOnD -_-_-
* displays the logged in users Sent box - messages sent */
require "/Model/ModelFacade.php";
//redirect if user not logged in
ModelFacade::redirectUnauthorised();
OnRequest();
function OnRequest()
{
if (isset($_POST['delMsg'])) {
foreach ($_POST['delMsg'] as $eachDelMsg)
ModelFacade::deleteMsg($eachDelMsg);
header('Location: /DirectMsgSent.php');
}
$user = ModelFacade::getLoggedInUser();
$messages = ModelFacade::getUsersSentbox($user->id);
//display confirmation if message was just sent
if (isset($_GET['newMsgSent'])) {
$newMsgSent = $_GET['newMsgSent'];
if ($newMsgSent === 'true')
$newMsgSent = "MESSAGE SENT SUCCESSFULLY";
else
$newMsgSent = "MESSAGE SEND FAILED - NO SUCH USER EXISTS";
} else
$newMsgSent = "";
include_once('/Views/DirectMsgSent.html');
}