Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = empty($_SERVER['PHP_AUTH_USER']) ? NULL : $_SERVER['PHP_AUTH_USER'];
- $pass = empty($_SERVER['PHP_AUTH_PW']) ? NULL : $_SERVER['PHP_AUTH_PW'];
- if (empty($user)) {
- header('WWW-Authenticate: Basic realm="Mi dominio"');
- header('HTTP/1.0 401 Unauthorized');
- header('Content-Type: text/plain; charset=utf-8');
- echo 'Noup. No es así.';
- exit;
- }
- if ($user !== 'admin' || $pass !== 'admin') {
- header('HTTP/1.0 401 Unauthorized');
- header('Content-Type: text/plain; charset=utf-8');
- echo "Le has pifiado la contraseña.";
- exit;
- }
- header('Content-Type: text/plain; charset=utf-8');
- echo "Hell yeah!!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement