Código:
<?php if (!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic realm="'.$sitename.' Admin"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != $adlogin) || ($PHP_AUTH_PW != $adpassword)) { header('WWW-Authenticate: Basic realm="'.$sitename.' Admin"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; }else{ session_register("aid"); session_register("apass"); } } ?>