-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessagerie.php
More file actions
257 lines (225 loc) · 5.75 KB
/
messagerie.php
File metadata and controls
257 lines (225 loc) · 5.75 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<?php
session_start();
require 'autoload.php';
use ShadeLife\auth;
use ShadeLife\Players;
use ShadeLife\ident;
use ShadeLife\BlueFort;
use ShadeLife\ShadeLife;
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
<style>
a{
color: white;
}
a:hover{
color: white;
}
#to{
visibility:hidden;
}
.form-control{
width: 400%;
}
</style>
<link rel="stylesheet" href="<?= cssuri(); ?>recherche.css">
<?php
auth::connection();
auth::veriffLoginUsers();
if(ident::getCoplevel(1))
{
require 'assets/auto/navbar-gendarmerie.php';
}elseif(ident::getCoplevel(5))
{
require 'assets/auto/navbar-gendarmerie.php';
} else
{
require 'assets/auto/navbar.php';
}
?>
<div class="bandeau">
<div class="container">
<div class="row">
<div class="col-sm-12">
<p class="recherche1">Messagerie</p>
</div>
</div>
</div>
</div>
</div>
<?php
if(isset($_GET['message']))
{
$message = "Le message à bien était envoyer ";
?>
<div class="grade container-fluid">
<div class="row">
<div class="col-12">
<div class="alert alert-primary" role="alert">
<?= $message; ?>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="container">
<div class="row grade">
<div class="col">
<div class="btn-group-vertical align-self-start" role="group" aria-label="Vertical button group">
<button type="button" class="btn btn-dark" onclick="compmessage()">Nouveau message</button>
<button class="btn btn-light" onclick="repmessage()" type="button">Boîte de réception <?= ShadeLife::GetMessage();?></button>
<button class="btn btn-light" onclick="sendmessage()" type="button">Messages envoyés</button>
</div>
</div>
<?php
if(isset($_GET['inbox']))
{
?>
<div class="col-sm-9">
<div class="d-flex ">
<table class="table table-dark">
<tbody>
<tr>
<td>De:</td>
<td>Suject:</td>
</tr>
<?php
$req = $bdd->query("SELECT * FROM messagerie JOIN players WHERE players.pid = messagerie.topid AND players.pid = ".$_SESSION["pid"]." GROUP BY id desc ");
while($r = $req->fetch())
{
?>
<tr>
<td><a href="?id=<?= $r['id']?>"><button type="button" class="btn btn-dark" data-toggle="modal" data-target="#mess"> <?= $r['name'];?></a><?= $clients->GetMarqueLu($r['id']);?></td></button>
<td><?= $r['messsubject'];?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}elseif (isset($_GET['send'])) {
?>
<div class="col-sm-9">
<div class="d-flex ">
<table class="table table-dark">
<tbody>
<tr>
<td>Envoyer a:</td>
<td>Suject:</td>
</tr>
<?php
$req = $bdd->query("SELECT * FROM players JOIN messagerie WHERE players.pid = messagerie.topid AND messagerie.frompid = ".$_SESSION['pid']." GROUP BY id desc ");
while($r = $req->fetch())
{
?>
<tr>
<td><a href="?id=<?= $r['id']?>"><button type="button" class="btn btn-dark" data-toggle="modal" data-target="#mess"> <?= $r['name'];?>1</a><?= $clients->GetMarqueLu($r['id']);?></td></button>
<td><?= $r['messsubject'];?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}elseif(isset($_GET['compose']))
{
$q = $bdd->query("SELECT * FROM players WHERE pid = ".$_SESSION["pid"]."");
$r = $q->fetch();
?>
<div class="col-9">
<div class="d-flex ">
<form method="post" action="assets/application/envoie.php">
<label for=""> De : <?= $r['name']; ?></label> <br>
<?php
if(isset($_GET['topid']))
{
?>
<label for="">Pour :</label><br>
<input class="form-control" type="text" value="<?= $_GET['topid'];?>" name="for">
<?php
}
?>
<label for="">Pour :</label><br>
<input class="form-control" type="text" name="for">
<label for="">Sujet :</label><br>
<input class="form-control" type="text" name="subject">
<div class="form-group">
<label for="">Votre message :</label><br>
<textarea id="my-textarea" class="form-control" name="messages" rows="3"></textarea>
</div>
<button class="btn btn-dark" type="submit">Envoyer</button>
</form>
<?php
}else {
if(isset($_GET['id']))
{
$id = htmlspecialchars($_GET['id']);
$q = $bdd->prepare("UPDATE messagerie SET lu = :lu WHERE id = :id AND topid = ".$_SESSION['pid']."");
$q->bindValue('lu', 1);
$q->bindValue('id', $id);
$q->execute();
$q = $bdd->query("SELECT * FROM messagerie JOIN players WHERE id = ".$id." AND messagerie.frompid = players.pid");
$r = $q->fetch();
?>
<div class="container">
<div class="row">
<div class="col-3"></div>
<div class="col-9">
<h5>De : <?= $r["name"];?></h5>
<h6>Subject: <?= $r["messsubject"];?></h6>
<div>
<?= $r['messmessage'];?>
</div>
<br>
<br>
<form method="post" action="assets/application/envoie-reponse.php">
<div class="form-group">
<label for="my-textarea">Répondre : </label>
<textarea id="my-textarea" class="form-control" name="message" rows="3"></textarea>
</div>
<input id="my-input" type="hidden" name="id" value="<?= $_GET['id']?>">
<input id="my-input" type="hidden" name="topid" value="<?= $r['frompid']?>">
<button type="submit" class="btn btn-dark">Envoyer</button>
</form>
<div class="alert alert-danger" role="alert">
Non active !
</div>
</div>
</div>
</div>
<?php
}else{
?>
<script>
window.location.replace('?inbox')
</script>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php
require 'footer.php';
?>
<script>
function compmessage()
{
window.location.replace('?compose');
}
function sendmessage()
{
window.location.replace('?send');
}
function repmessage()
{
window.location.replace('?inbox');
}
</script>