Checking PHP's global authentication variables : isset « Data Type « PHP






Checking PHP's global authentication variables

 
<?
if ( (! isset ($PHP_AUTH_USER)) || (! isset ($PHP_AUTH_PW)) ): 
     header('WWW-Authenticate: Basic realm="Secret Family"');
     header('HTTP/1.0 401 Unauthorized');
     print "Authorization is required.";
     exit;
endif;
?>
  
  








Related examples in the same category

1.Checking Whether a Variable Is Set: isset( )
2.Using the isset() function to see whether an array element is defined for a given index.
3.bool isset ( mixed var [, mixed var [, ...]] ) returns true if its parameter has been set
4.Viewing the username cookie