Created
October 28, 2015 05:56
-
-
Save vermaslal/aef17f1c59f4c4ee500a to your computer and use it in GitHub Desktop.
Prompt Browser password dialog : Browser Password Dialog « Login Authentication « PHP
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 | |
if (!isset($_SERVER['PHP_AUTH_USER']) || ($_SERVER['PHP_AUTH_USER'] != 'specialuser') || ($_SERVER['PHP_AUTH_PW'] != 'secretpassword')) { | |
header('WWW-Authenticate: Basic Realm="Secret Stash"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
print('You must provide the proper credentials!'); | |
exit; | |
} else { | |
print('Authenticated!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment