Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // -------------------------------------------------------------
- // Secure QA site
- $staging_sites = array('som.palbeta.com');
- if (in_array($_SERVER['HTTP_HOST'], $staging_sites)) {
- $username = 'som';
- $password = 'somsomsom';
- // PHP-cgi fix
- $a = base64_decode(substr($_SERVER["REMOTE_USER"], 6)) ;
- if ( (strlen($a) == 0) || ( strcasecmp($a, ":") == 0)) {
- header('WWW-Authenticate: Basic realm="Private"');
- header('HTTP/1.0 401 Unauthorized');
- }
- else {
- list($name, $password) = explode(':', $a);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
- if (! (isset($_SERVER['PHP_AUTH_USER']) && ($_SERVER['PHP_AUTH_USER'] == $username && $_SERVER['PHP_AUTH_PW'] == $password))) {
- header('WWW-Authenticate: Basic realm="This site is protected"');
- header('HTTP/1.0 401 Unauthorized');
- // Fallback message when the user presses cancel / escape
- echo 'Access denied';
- exit;
- }
- }
Add Comment
Please, Sign In to add comment