Updated anti-idiot checks

This commit is contained in:
Wruczek 2016-06-29 00:28:29 +02:00
parent 35871e8e94
commit a28ffdedf2
4 changed files with 48 additions and 72 deletions

View File

@ -5,6 +5,8 @@ AddDefaultCharset UTF-8
# DISABLE DIRECTORY LISTING
Options -Indexes
SetEnv HTACCESS on
ErrorDocument 403 "<!DOCTYPE html><html lang=\"pl\"><head> <meta charset=\"utf-8\"> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> <meta name=\"author\" content=\"Wruczek\"> <title>403 - brak dost&#281;pu</title> <link rel=\"shortcut icon\" href=\"img/icon/icon-64.png\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;\"></head><body style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;margin: 0;font-family: &quot;Lato&quot;,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size: 15px;line-height: 1.42857143;color: #ebebeb;background-color: #2b3e50;\"> <div class=\"container\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;margin-right: auto;margin-left: auto;padding-left: 15px;padding-right: 15px;display: table;position: absolute;height: 100%;width: 100%;\"> <div class=\"text-center\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;text-align: center;display: table-cell;vertical-align: middle;\"> <h1 style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 39px;margin: 0.67em 0;font-family: inherit;font-weight: 400;line-height: 1.1;color: inherit;margin-top: 21px;margin-bottom: 10.5px;\">403 <span style=\"font-size: 32px;color: #9E9E9E;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;\">brak dost&#281;pu</span></h1> <h3 style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;orphans: 3;widows: 3;page-break-after: avoid;font-family: inherit;font-weight: 400;line-height: 1.1;color: inherit;margin-top: 21px;margin-bottom: 10.5px;font-size: 26px;\">Nie posiadasz uprawnie&#324; do przegl&#261;dania tej strony.</h3> <br style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;\"> <a href=\".\" class=\"btn btn-primary btn-lg\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;background-color: #df691a;color: #ffffff;text-decoration: none;display: inline-block;margin-bottom: 0;font-weight: normal;text-align: center;vertical-align: middle;-ms-touch-action: manipulation;touch-action: manipulation;cursor: pointer;background-image: none;border: 1px solid transparent;white-space: nowrap;padding: 12px 24px;font-size: 19px;line-height: 1.3333333;border-radius: 0;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;border-color: transparent;\">&larr;&nbsp;&nbsp;&nbsp;Powr&oacute;t</a> </div></div></body></html>"
ErrorDocument 404 "<!DOCTYPE html><html lang=\"pl\"><head> <meta charset=\"utf-8\"> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> <meta name=\"author\" content=\"Wruczek\"> <title>404 - nie znaleziono</title> <link rel=\"shortcut icon\" href=\"img/icon/icon-64.png\"></head><body style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;margin: 0;font-family: &quot;Lato&quot;,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size: 15px;line-height: 1.42857143;color: #ebebeb;background-color: #2b3e50;\"> <div class=\"container\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;margin-right: auto;margin-left: auto;padding-left: 15px;padding-right: 15px;display: table;position: absolute;height: 100%;width: 100%;\"> <div class=\"text-center\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;text-align: center;display: table-cell;vertical-align: middle;\"> <h1 style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 39px;margin: 0.67em 0;font-family: inherit;font-weight: 400;line-height: 1.1;color: inherit;margin-top: 21px;margin-bottom: 10.5px;\">404 <span style=\"font-size: 32px;color: #9E9E9E;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;\">strony nie znaleziono</span></h1> <h3 style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;orphans: 3;widows: 3;page-break-after: avoid;font-family: inherit;font-weight: 400;line-height: 1.1;color: inherit;margin-top: 21px;margin-bottom: 10.5px;font-size: 26px;\">Strona kt&oacute;rej szukasz nie zosta&#322;a odnaleziona.</h3> <br style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;\"> <a href=\".\" class=\"btn btn-primary btn-lg\" style=\"-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;background-color: #df691a;color: #ffffff;text-decoration: none;display: inline-block;margin-bottom: 0;font-weight: normal;text-align: center;vertical-align: middle;-ms-touch-action: manipulation;touch-action: manipulation;cursor: pointer;background-image: none;border: 1px solid transparent;white-space: nowrap;padding: 12px 24px;font-size: 19px;line-height: 1.3333333;border-radius: 0;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;border-color: transparent;\">&larr;&nbsp;&nbsp;&nbsp;Powr&oacute;t</a> </div></div></body></html>"

View File

@ -1,53 +0,0 @@
<?php if(!file_exists(__DIR__ . "/../config/config.php")) { ?>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Brak wymaganych rozszerzeń">
<meta name="author" content="Wruczek">
<title>BŁĄD: Brak pliku config.php</title>
<!-- Icon -->
<link rel="shortcut icon" href="https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png">
<!-- Twitter Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/superhero/bootstrap.min.css" rel="stylesheet">
<!--[if IE]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
body { margin-top: 70px }
</style>
</head>
<body>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><img src="https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png" width="20px">Brak pliku config.php</h3>
</div>
<div class="panel-body">
<p>Przejdź do folderu <code>config</code> i zmień nazwę pliku z <code>config.template.php</code> na <code>config.php</code>.</p>
<p>Skonfiguruj stronę według własnych potrzeb.</p>
</div>
</div>
</div>
<!-- /container -->
</body>
</html>
<?php
die();
}

View File

@ -1,10 +1,7 @@
<?php
$start = microtime(true);
require_once __DIR__ . "/configcheck.php";
require_once __DIR__ . "/modulecheck.php";
require_once __DIR__ . "/../include/modulecheck.php";
require_once __DIR__ . "/../config/config.php";
require_once __DIR__ . "/../include/adminlist.php";
// require_once __DIR__ . "/include/adminlist.php";
?>
<!DOCTYPE html>
<html lang="pl">

View File

@ -1,5 +1,45 @@
<?php if(!in_array('mod_rewrite', apache_get_modules())) { ?>
<?php
if (!isset($_SERVER['HTACCESS'])) {
$title = 'Plik .htaccess nie jest włączony';
$text = '<p>Strona wymaga włączonej obsługi pliku <code>.htaccess</code>.</p>
<p><a href="https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file">Poradnik na temat właczania pliku htaccess</a></p>';
die(showError($title, $text));
}
if(!in_array('mod_rewrite', apache_get_modules())) {
$title = 'Brak wymaganych rozszerzeń';
$text = '<p>Na swoim serwerze nie posiadasz modułu <code>rewrite</code> wymaganego do poprawnego działania tej strony.</p>
<p>Posiadasz system Ubuntu? Świetnie! Uruchom poniższe komendy, by włączyć wymagany moduł:</p>
<pre>sudo a2enmod rewrite
sudo service apache2 reload</pre>
<p>Używasz system Debian? Uruchom owe komendy pomijając przedrostek <code>sudo</code>:</p>
<pre>a2enmod rewrite
service apache2 reload</pre>
<p>Jeśli używasz hostingu i nie masz dostępu do konsoli, skontaktuj się z administratorem lub pomocą techniczną Twojego hostingu.</p>';
die(showError($title, $text));
}
if(!file_exists(__DIR__ . "/../config/config.php")) {
$title = 'Brak pliku config.php';
$text = '<p>Przejdź do folderu <code>config</code> i zmień nazwę pliku z <code>config.template.php</code> na <code>config.php</code>.</p>
<p>Skonfiguruj stronę według własnych potrzeb.</p>';
die(showError($title, $text));
}
// FUNCTION
function showError($title, $text) { ?>
<!DOCTYPE html>
<html lang="pl">
@ -11,7 +51,7 @@
<meta name="description" content="Brak wymaganych rozszerzeń">
<meta name="author" content="Wruczek">
<title>BŁĄD: Brak wymaganych rozszerzeń</title>
<title><?php echo $title; ?></title>
<!-- Icon -->
<link rel="shortcut icon" href="https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png">
@ -34,17 +74,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><img src="https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png" width="20px">Brak wymaganych rozszerzeń</h3>
<h3 class="panel-title"><img src="https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png" width="20px"> <?php echo $title; ?></h3>
</div>
<div class="panel-body">
<p>Na swoim serwerze nie posiadasz modułu <code>rewrite</code> wymaganego do poprawnego działania tej strony.</p>
<p>Posiadasz system Ubuntu? Świetnie! Uruchom poniższe komendy, by włączyć wymagany moduł:</p>
<pre>sudo a2enmod rewrite
sudo service apache2 reload</pre>
<p>Używasz system Debian? Uruchom owe komendy pomijając przedrostek <code>sudo</code>:</p>
<pre>a2enmod rewrite
service apache2 reload</pre>
<p>Jeśli używasz hostingu i nie masz dostępu do konsoli, skontaktuj się z administratorem lub pomocą techniczną Twojego hostingu.</p>
<?php echo $text; ?>
</div>
</div>
@ -53,7 +86,4 @@ service apache2 reload</pre>
</body>
</html>
<?php
die();
}
<?php }