-
-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy patherreur.php
More file actions
266 lines (239 loc) · 8.06 KB
/
Copy patherreur.php
File metadata and controls
266 lines (239 loc) · 8.06 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
258
259
260
261
262
263
264
265
266
<?php
/**
* erreur.php
* Page de gestion des erreurs HTTP 404, 500, etc.
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2026-02-18 18:23$
* @author Laurent Delineau & JeromeB & Yan Naessens
* @copyright Since 2003 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
*
* This file is part of GRR.
*
* GRR is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
// Récupérer le code d'erreur
$error_code = 500;
$error_title = "Erreur serveur";
$error_message = "Une erreur est survenue sur le serveur.";
// Parser l'URL pour déterminer le code d'erreur s'il est défini
if (isset($_SERVER['REDIRECT_STATUS']) && is_numeric($_SERVER['REDIRECT_STATUS'])) {
$error_code = (int)$_SERVER['REDIRECT_STATUS'];
} elseif (isset($_GET['code']) && is_numeric($_GET['code'])) {
$error_code = (int)$_GET['code'];
}
if(isset($_GET['grr_script_name']))
$url = $_GET['grr_script_name'];
else
$url = $_SERVER['REQUEST_URI'];
if(isset($_GET['infosdebug']))
$infodebug = $_GET['infosdebug'];
else
$infodebug = '';
// Déterminer le message selon le code d'erreur
switch ($error_code) {
case 400:
$error_title = "Mauvaise requête";
$error_message = "La requête envoyée n'est pas valide. Vérifiez les paramètres.";
break;
case 401:
$error_title = "Authentification requise";
$error_message = "Vous devez vous authentifier pour accéder à cette ressource.";
break;
case 403:
$error_title = "Accès refusé";
$error_message = "Vous n'avez pas les permissions pour accéder à cette page.";
break;
case 404:
$error_title = "Page non trouvée";
$error_message = "Désolé, la page que vous recherchez n'existe pas ou a été supprimée.";
break;
case 405:
$error_title = "Méthode non autorisée";
$error_message = "La méthode HTTP utilisée n'est pas autorisée pour cette ressource.";
break;
case 408:
$error_title = "Délai d'attente écoulé";
$error_message = "La requête a pris trop de temps. Veuillez réessayer.";
break;
case 410:
$error_title = "Ressource supprimée";
$error_message = "Cette ressource n'existe plus et ne sera pas restaurée.";
break;
case 500:
$error_title = "Erreur serveur interne";
$error_message = "Oups ! Une erreur est survenue sur le serveur.";
break;
case 501:
$error_title = "Non implémenté";
$error_message = "Cette fonctionnalité n'est pas encore implémentée sur ce serveur.";
break;
case 502:
$error_title = "Mauvaise passerelle";
$error_message = "Le serveur a reçu une réponse invalide.";
break;
case 503:
$error_title = "Service indisponible";
$error_message = "Le serveur est temporairement indisponible.";
break;
case 504:
$error_title = "Dépassement du délai de la passerelle";
$error_message = "La passerelle n'a pas reçu de réponse à temps.";
break;
default:
$error_title = "Erreur HTTP " . $error_code;
$error_message = "Une erreur HTTP est survenue.";
}
// Définir le code HTTP de réponse
http_response_code($error_code);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GRR - Erreur <?php echo $error_code; ?></title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 20px;
}
.error-container {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
text-align: center;
max-width: 600px;
width: 100%;
}
.error-code {
font-size: 100px;
font-weight: bold;
color: #667eea;
margin: 0 0 10px 0;
line-height: 1;
}
.error-title {
font-size: 28px;
color: #333;
margin: 10px 0 20px 0;
}
.error-message {
font-size: 16px;
color: #666;
margin: 20px 0;
line-height: 1.6;
}
.error-details {
background: #f5f5f5;
padding: 15px;
border-radius: 5px;
margin: 20px 0;
text-align: left;
font-size: 13px;
color: #666;
word-break: break-all;
border-left: 4px solid #667eea;
}
.error-details strong {
display: block;
margin-bottom: 5px;
color: #333;
}
.alert {
background: #fff3cd;
border: 1px solid #ffc107;
color: #856404;
padding: 12px;
border-radius: 5px;
margin: 20px 0;
font-size: 14px;
}
.button-group {
margin-top: 30px;
display: flex;
gap: 10px;
justify-content: center;
flex-wrap: wrap;
}
.btn {
display: inline-block;
padding: 12px 30px;
border-radius: 5px;
text-decoration: none;
font-weight: bold;
transition: all 0.3s ease;
cursor: pointer;
border: none;
font-size: 16px;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #764ba2;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
background: #e0e0e0;
color: #333;
}
.btn-secondary:hover {
background: #d0d0d0;
transform: translateY(-2px);
}
.app-name {
font-size: 12px;
color: #999;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #eee;
}
</style>
</head>
<body>
<div class="error-container">
<div class="error-code"><?php echo $error_code; ?></div>
<h2 class="error-title"><?php echo htmlspecialchars($error_title); ?></h2>
<p class="error-message">
<?php echo htmlspecialchars($error_message); ?>
</p>
<?php if ($error_code >= 500): ?>
<div class="alert">
<strong>⚠️ Important :</strong> Si le problème persiste, veuillez contacter l'administrateur du système.
</div>
<?php endif; ?>
<div class="error-details">
<strong>Informations techniques :</strong>
Date/Heure : <?php echo date('d/m/Y à H:i:s'); ?><br>
URL demandée : <?php echo htmlspecialchars($url); ?><br>
<?php if (!empty($infodebug)): ?>
Détails de l'erreur : <?php echo htmlspecialchars($infodebug); ?>
<?php endif; ?>
</div>
<div class="button-group">
<a href="./" class="btn btn-primary">← Retour à l'accueil</a>
<button onclick="history.back()" class="btn btn-secondary">← Page précédente</button>
</div>
<div class="app-name">
GRR - Gestion et Réservation de Ressources
</div>
</div>
</body>
</html>