Guest User

Untitled

a guest
Aug 12th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Why is simple PHP header authorization not working
  2. $username = 'test';
  3. $password = 'test';
  4.  
  5. If (!isset($_SERVER['PHP_AUTH_USER'])|| !isset($_SERVER ['PHP_AUTH_PW'])||
  6. ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)){
  7.  
  8. //send this if the user and pass arent correct
  9.  
  10. header('HTTP/1.1 401 Unauthorized');
  11. header('WWW-Authenticate: Basic Realm= "mysite"');
  12. exit('<h2> Go away Creep!!</h2> you need a username and password to enter this kingdom!!');
  13. }
Add Comment
Please, Sign In to add comment