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; ?>