-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessages.php
More file actions
33 lines (23 loc) · 866 Bytes
/
messages.php
File metadata and controls
33 lines (23 loc) · 866 Bytes
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
<?php
session_start();
require_once 'bootstrap.php';
use OWG\Weggeefwinkel\Business\ItemService;
use OWG\Weggeefwinkel\Business\UserService;
use OWG\Weggeefwinkel\Business\CityService;
use OWG\Weggeefwinkel\Business\MessageService;
if (!isset($_SESSION["username"])) {
header("location: login.php");
exit(0);
} else {
$username = $_SESSION["username"];
$userid = $_SESSION["id"];
//print $userid;
$messageSvc = new MessageService();
if (isset($_POST['send'])) {
print ("jaja");
$messageSvc->writeMessage($_POST['title'], $_POST['text'], $_SESSION['username'], null);
}
$messageList = $messageSvc->getUserMessages($userid);
$view = $twig->render("messages.twig", array("username" => $username, "messageList" => $messageList, "messagesActive" => "active"));
print($view);
}