Last active
August 30, 2020 13:44
-
-
Save Postnov/640749b1598745ef2b447040412a1b1e to your computer and use it in GitHub Desktop.
Доступ к сайту по паролю
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Файл htaccess лежит в корневой папке сайта, туда вставить этот код и поменять путь к файлу с пользователями | |
AuthType Basic | |
AuthName "Protected Area" | |
AuthUserFile полный путь до файла. Узнаем его через файл ups.php (прикреплен ниже) | |
Require valid-user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Файл с содержимым пользователей. Положить лучше в какую-то неприметную папку для безопасности. | |
# generator - https://web-specialist.info/htpasswd-gen/ | |
admin:12Dasfnl <- пароль в зашифрованном виде. Генерить по ссылке | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Document root: '.$_SERVER['DOCUMENT_ROOT'].'<br>'; | |
echo 'Полный путь к скрипту и его имя: '.$_SERVER['SCRIPT_FILENAME'].'<br>'; | |
echo 'Имя скрипта: '.$_SERVER['SCRIPT_NAME']; | |
// закинуть файл в директорию сайта и открыть его. Тогда узнаем полный путь, когда узнаем путь и вставляем в htaccess, | |
// этот файл можно удалять | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment