SHARE
TWEET

Untitled

a guest Aug 17th, 2018 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Http authentication not working in linux hosted website
  2. <?php
  3.  // User name and password for authentication
  4.  
  5. $username='username';
  6. $password='password';
  7.  
  8.  
  9. if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
  10. ($_SERVER['PHP_AUTH_USER'] !=$username) || ($_SERVER['PHP_AUTH_PW'] !=$password))
  11. {
  12.  // The user name/password are incorrect so send the authentication headers
  13.    header('HTTP/1.1 401 Unauthorized');
  14.   header('WWW-Authenticate: Basic realm="My Web Page:The Freedom Square Of Internet"');
  15.   exit('<h2>My Web page</h2>Sorry, you must enter a valid user name and password to access this page.');
  16.   }
  17. ?>
  18.    
  19. RewriteCond %{HTTP:Authorization} ^(.+)
  20. RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top