diff --git a/admin/index.php b/admin/index.php index ad2b68d..170dfca 100644 --- a/admin/index.php +++ b/admin/index.php @@ -85,5 +85,22 @@ $user = \S::get_session( 'user', true ); \admin\Site::update(); \admin\Site::special_actions(); +$domain = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] ); +$cookie_name = str_replace( '.', '-', $domain ); + +if ( isset( $_COOKIE[$cookie_name] ) && !isset( $_SESSION['user'] ) ) +{ + $obj = json_decode( $_COOKIE[$cookie_name] ); + $login = $obj -> {'login'}; + $password = $obj -> {'hash'}; + + if ( $mdb -> get( 'pp_users', '*', [ 'AND' => [ 'login' => $login, 'status' => 1, 'password' => $password ] ] ) ) + { + \S::set_session( 'user', \admin\factory\Users::details( $login ) ); + header( 'Location: /admin/articles/view_list/' ); + exit; + } +} + echo \admin\view\Page::show(); ?> \ No newline at end of file diff --git a/admin/layout/.htaccess b/admin/layout/.htaccess new file mode 100644 index 0000000..4aba16f --- /dev/null +++ b/admin/layout/.htaccess @@ -0,0 +1,20 @@ +# Wyłącz listowanie +Options -Indexes + +# Domyślnie blokujemy wszystko… +Require all denied + +# …a dopiero potem pozwalamy na pliki statyczne + + Require all granted + + +# Twardo blokuj cokolwiek, co mogłoby się wykonać + + Require all denied + + +# Nie serwuj plików ukrytych (.env itp.) + + Require all denied + \ No newline at end of file diff --git a/admin/templates/.htaccess b/admin/templates/.htaccess new file mode 100644 index 0000000..4aba16f --- /dev/null +++ b/admin/templates/.htaccess @@ -0,0 +1,20 @@ +# Wyłącz listowanie +Options -Indexes + +# Domyślnie blokujemy wszystko… +Require all denied + +# …a dopiero potem pozwalamy na pliki statyczne + + Require all granted + + +# Twardo blokuj cokolwiek, co mogłoby się wykonać + + Require all denied + + +# Nie serwuj plików ukrytych (.env itp.) + + Require all denied + \ No newline at end of file diff --git a/admin/templates/site/unlogged-layout.php b/admin/templates/site/unlogged-layout.php index ffe1aaa..9e24134 100644 --- a/admin/templates/site/unlogged-layout.php +++ b/admin/templates/site/unlogged-layout.php @@ -63,9 +63,15 @@ -
- -
+
+
+ + +
+
+
+ +