daily pastebin goal
77%
SHARE
TWEET

HTTP BASI AUTENTICATION

raylinanthony Jan 28th, 2016 (edited) 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 ***/
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