This repository has been archived by the owner on Jul 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
act.php
115 lines (97 loc) · 2.53 KB
/
act.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
if (count($_POST) > 0) :
require_once(".classes/controller.php");
session_start();
setlocale(LC_TIME, "fr_FR");
$_POST["date"] = microtime(true);
// LOGIN & LOGOUT
if (isset($_POST["login"]) || isset($_POST["logout"])) :
$_SESSION["TChat"] = new Controller();
// LOGIN
if (isset($_POST["login"])) :
$_SESSION["TChat"]->login($_POST["login"]);
endif;
// LOGOUT
if (isset($_POST["logout"])) :
$_SESSION["TChat"]->logout($_POST["logout"]);
endif;
endif;
// CHANNEL
if (isset($_POST["channel"])) :
$_SESSION["TChat"] = new Controller($_POST["channel"]);
// DELETE
if (isset($_POST["delete"])) :
// DELETE MESSAGE
if (isset($_POST["message"])) :
$_SESSION["TChat"]->deleteMessage($_POST["message"], $_POST["time"]);
var_dump($_POST);
endif;
// DELETE CHANNEL
if (!isset($_POST["message"])) :
$_SESSION["TChat"]->deleteChannel($_POST["channel"]);
endif;
endif;
// CREATE CHANNEL
if (isset($_POST["create"])) :
$_SESSION["TChat"]->createChannel($_POST["channel"]);
endif;
// RESET CHANNEL
if (isset($_POST["reset"])) :
$_SESSION["TChat"]->resetMessages();
endif;
// GET CHANNEL
if (isset($_POST["get"])) :
$_SESSION["TChat"] = new Controller($_POST["channel"]);
$items = $_SESSION["TChat"]->getMessages();
if (!empty($items)) :
foreach ($items as $item) :
echo $item;
endforeach;
endif;
endif;
// POST CHANNEL
if (isset($_POST["author"]) && isset($_POST["content"])) :
$_SESSION["TChat"]->addMessages(array_map("trim", $_POST));
endif;
endif;
// USERS
if (isset($_POST["users"])) :
$_SESSION["TChat"] = new Controller();
// USERS GET
if (isset($_POST["get"])) :
$members = $_SESSION["TChat"]->getMembers();
if (!empty($members)) :
foreach ($members as $member) :
echo $member;
endforeach;
endif;
endif;
endif;
// USERS DELETE
if (isset($_POST["usersdelete"])) :
$_SESSION["TChat"] = new Controller();
$_SESSION["TChat"]->deleteUser(trim($_POST["usersdelete"]));
endif;
// CHANNELS
if (isset($_POST["channels"])) :
$_SESSION["TChat"] = new Controller();
// CHANNELS GET
if (isset($_POST["get"])) :
$channels = $_SESSION["TChat"]->getChannels();
if (!empty($channels)) :
echo $channels;
endif;
endif;
endif;
// CHANGE
if (isset($_POST["change"])) :
$_SESSION["TChat"] = new Controller($_POST["change"]);
$items = $_SESSION["TChat"]->changeChannel();
if (!empty($items)) :
foreach ($items as $item) :
echo $item;
endforeach;
endif;
endif;
endif;
?>