Guest User

Untitled

a guest
Nov 17th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. // -------------------------------------------------------------
  2. // Secure QA site
  3. $staging_sites = array('som.palbeta.com');
  4. if (in_array($_SERVER['HTTP_HOST'], $staging_sites)) {
  5.  
  6. $username = 'som';
  7. $password = 'somsomsom';
  8.  
  9. // PHP-cgi fix
  10. $a = base64_decode(substr($_SERVER["REMOTE_USER"], 6)) ;
  11. if ( (strlen($a) == 0) || ( strcasecmp($a, ":") == 0)) {
  12. header('WWW-Authenticate: Basic realm="Private"');
  13. header('HTTP/1.0 401 Unauthorized');
  14. }
  15. else {
  16. list($name, $password) = explode(':', $a);
  17. $_SERVER['PHP_AUTH_USER'] = $name;
  18. $_SERVER['PHP_AUTH_PW'] = $password;
  19. }
  20.  
  21. if (! (isset($_SERVER['PHP_AUTH_USER']) && ($_SERVER['PHP_AUTH_USER'] == $username && $_SERVER['PHP_AUTH_PW'] == $password))) {
  22. header('WWW-Authenticate: Basic realm="This site is protected"');
  23. header('HTTP/1.0 401 Unauthorized');
  24. // Fallback message when the user presses cancel / escape
  25. echo 'Access denied';
  26. exit;
  27. }
  28. }
Add Comment
Please, Sign In to add comment