A
A
alex_belouss2017-04-16 06:00:11
PHP
alex_belouss, 2017-04-16 06:00:11

How not to let in on a site by country using geoip and let in from a closed country with a password?

31634766e7e74fb6b6da389ae1a43d7b.jpg
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

2 answer(s)
S
Stalker_RED, 2017-04-16
@Stalker_RED

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>";
}
?>

U
UksusoFF, 2017-04-16
@UksusoFF

https://github.com/Torann/laravel-geoip + https://laravel.com/docs/5.4/authentication#http-b...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question