Headers Login System
<?
$auth = false;
$members = ".members";
if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW) && is_file($members)) {
$data = file($members);
foreach($data as $show) {
$show = trim($show);
$part = explode("|",$show);
if ($part[0] == $PHP_AUTH_USER && $part[1] == $PHP_AUTH_PW) {
$auth = true;
break;
}
}
}
if (!$auth) {
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
}
else {
echo '<P>Your are authorized!</A></P>';
}
?>