Answer the question
In order to leave comments, you need to log in
How not to let in on a site by country using geoip and let in from a closed country with a password?
Entrance to this site is prohibited from Kyrgyzstan, but at the same time a window for entering a password is displayed, if you enter a password from Kyrgyzstan, it lets you into the site, but so far I have secured access from the country with the help of geoip. How to bind an authorization window?
Answer the question
In order to leave comments, you need to log in
HTTP Authentication in PHP
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Текст, отправляемый в том случае,
если пользователь нажал кнопку Cancel';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>Вы ввели пароль {$_SERVER['PHP_AUTH_PW']}.</p>";
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question