Created
December 15, 2016 21:35
-
-
Save ZAYEC77/a47852454305ed3ba642c1f1faa51392 to your computer and use it in GitHub Desktop.
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 | |
| function authenticate() { | |
| header('WWW-Authenticate: Basic realm="Test Authentication System"'); | |
| header('HTTP/1.0 401 Unauthorized'); | |
| exit; | |
| } | |
| if (!isset($_SERVER['PHP_AUTH_USER'])){ | |
| authenticate(); | |
| } else { | |
| if ($_SERVER['PHP_AUTH_USER'] == 'admin' && $_SERVER['PHP_AUTH_PW'] == 'admin') { | |
| echo "Welcome"; | |
| } else { | |
| authenticate(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment