Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $authorization = $_SERVER["HTTP_AUTHORIZATION"];
- $success = preg_match("/Basic ([a-zA-Z0-9\+\/=]+)/", $authorization, $matches);
- $good_user = "Prueba";
- $good_password = "123";
- if($success) {
- $decoded = base64_decode($matches[1], true);
- $parts = explode(':',$decoded);
- $user = $parts[0];
- $password = $parts[1];
- if($user != $good_user || $password != $good_password){
- http_response_code(401);
- } else {
- echo "User: $user \nPassword: $password";
- }
- } else {
- http_response_code(401);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement