Advertisement
raylinanthony

HTTP BASI AUTENTICATION

Jan 28th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. /*** AUTH ***/
  2.  
  3. $dominio = 'Danilo Medina';
  4. $user = "danilo";
  5. $pass = "123";
  6.  
  7. if($no_auth !== true){
  8.  
  9.  
  10. if (!isset($_SERVER['PHP_AUTH_USER'])) {
  11. header('WWW-Authenticate: Basic realm="'.$dominio.'"');
  12. header('HTTP/1.0 401 Unauthorized');
  13. echo 'Denied Access';
  14. exit;
  15. } else {
  16. if($_SERVER["PHP_AUTH_USER"] != $user AND $_SERVER["PHP_AUTH_PW"] != $pass){
  17.  
  18. echo 'Credentials Access';
  19. exit;
  20. }
  21. }
  22.  
  23.  
  24.  
  25. }
  26.  
  27. /*** end AUTH ***/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement