Created
October 19, 2013 08:57
-
-
Save jeonghwan-kim/7053329 to your computer and use it in GitHub Desktop.
html authorization
This file contains hidden or 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 | |
| $username = 'user name'; | |
| $password = 'password'; | |
| $range = 'range'; | |
| if (!isset($_SERVER['PHP_AUTH_USER']) || | |
| !isset($_SERVER['PHP_AUTH_PW']) || | |
| ($_SERVER['PHP_AUTH_USER'] != $username) || | |
| ($_SERVER['PHP_AUTH_PW'] != $password)) | |
| { | |
| header('HTTP/1.1 401 Unauthorized'); | |
| header('WWW-Authenticate: Basic realm= "'.$range.'"'); | |
| exit('<p>Access denied.</p>'); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment