|
|
@@ -17,59 +17,4 @@
|
|
|
"authenticator",
|
|
|
"login",
|
|
|
"cron",
|
|
|
- ));
|
|
|
-
|
|
|
- // Filtre les IP authorisés à accéder au site
|
|
|
-
|
|
|
- function getUserIP() {
|
|
|
- $ip = 'Inconnu';
|
|
|
-
|
|
|
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
|
|
- // IP partagée par un proxy
|
|
|
- $ip = $_SERVER['HTTP_CLIENT_IP'];
|
|
|
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
|
- // IP du client derrière un proxy
|
|
|
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
|
- } else {
|
|
|
- // IP du client directement connectée au serveur
|
|
|
- $ip = $_SERVER['REMOTE_ADDR'];
|
|
|
- }
|
|
|
-
|
|
|
- // Nettoyage des IPs multiples dans le cas de 'HTTP_X_FORWARDED_FOR'
|
|
|
- if (strpos($ip, ',') !== false) {
|
|
|
- $ip = explode(',', $ip)[0];
|
|
|
- }
|
|
|
-
|
|
|
- return $ip;
|
|
|
- }
|
|
|
-
|
|
|
- if(!is_null(WHITE_IP)){
|
|
|
- if(!in_array(htmlspecialchars(getUserIP()), WHITE_IP)){
|
|
|
- header('HTTP/1.0 401 Unauthorized');
|
|
|
- header('Content-Type: text/html; charset=utf-8');
|
|
|
- echo ' <!DOCTYPE html>
|
|
|
- <html lang="fr">
|
|
|
- <head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <title>403 Accès Interdit</title>
|
|
|
- <style>
|
|
|
- body {
|
|
|
- font-family: Arial, sans-serif;
|
|
|
- background-color: #f8d7da;
|
|
|
- color: #721c24;
|
|
|
- text-align: center;
|
|
|
- padding: 50px;
|
|
|
- }
|
|
|
- h1 {
|
|
|
- font-size: 2em;
|
|
|
- }
|
|
|
- </style>
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <h1>403 Accès Interdit</h1>
|
|
|
- </body>
|
|
|
- </html>';
|
|
|
- exit();
|
|
|
- }
|
|
|
- }
|
|
|
+ ));
|