Kod
<?
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="n3team"');
header('HTTP/1.0 401 Unauthorized');
exit;
} else if (isset($PHP_AUTH_USER)) {
$plik = ".htpasswd";
$fp = fopen($plik, "r");
$zawartosc = fread($fp, filesize($plik));
fclose($fp);
$linia = explode("n", $zawartosc);
$i = 0;
while($i <= sizeof($linia)) {
$dane = explode(":", $linia[$i]);
if (($dane[0] == "$PHP_AUTH_USER") && ($dane[1] ==
"$PHP_AUTH_PW")) {
$auth = 1;
break;
} else {
$auth = 0;
}
$i++;
}
if ($auth == "1") {
echo "<p>Logged in!</p>";
exit;
} else {
header('WWW-Authenticate: Basic realm="IG3Net Control
Center"');
header('HTTP/1.0 401 Unauthorized');
echo 'Access Danied';
exit;
}
}
?>
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="n3team"');
header('HTTP/1.0 401 Unauthorized');
exit;
} else if (isset($PHP_AUTH_USER)) {
$plik = ".htpasswd";
$fp = fopen($plik, "r");
$zawartosc = fread($fp, filesize($plik));
fclose($fp);
$linia = explode("n", $zawartosc);
$i = 0;
while($i <= sizeof($linia)) {
$dane = explode(":", $linia[$i]);
if (($dane[0] == "$PHP_AUTH_USER") && ($dane[1] ==
"$PHP_AUTH_PW")) {
$auth = 1;
break;
} else {
$auth = 0;
}
$i++;
}
if ($auth == "1") {
echo "<p>Logged in!</p>";
exit;
} else {
header('WWW-Authenticate: Basic realm="IG3Net Control
Center"');
header('HTTP/1.0 401 Unauthorized');
echo 'Access Danied';
exit;
}
}
?>
ale on czyta hasla
user:pass
a jak zrobic zeby uzywac kodowane hasla
