Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_SERVER['PHP_AUTH_USER'])) {
- header("WWW-Authenticate: Basic realm=\"Private Area\"");
- header("HTTP/1.0 401 Unauthorized");
- print "Sorry - you need valid credentials to be granted access!\n";
- exit;
- } else {
- if (($_SERVER['PHP_AUTH_USER'] == 'username') && ($_SERVER['PHP_AUTH_PW'] == 'password')) {
- ?>
- <!--Content here--->
- <!--In my case it was an iframe to another site>
- <?php
- } else {
- header("WWW-Authenticate: Basic realm=\"Private Area\"");
- header("HTTP/1.0 401 Unauthorized");
- print "Sorry - you need valid credentials to be granted access!\n";
- exit;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement