Nu inteleg unde gresesc, mai jos este codul sursa.
<?php
if (!isset ($_SERVER['PHP_AUTH_USER']))
{
header ('WWW-Authenticate:Basic realm="Test"');
header ('HTTP/1.0 401 Unauthorized');
echo 'Pentru accesarea acestei pagini este necesara o autentificare!';
exit;
}
else {
$linkID=mysql_connect("localhost","root","");
mysql_select_db("BD-Date",$linkID);
$result = mysql_query("SELECT User, Password FROM user WHERE User = \"" . $_SERVER['PHP_AUTH_USER'] . "\" AND Password = \"" . $_SERVER['PHP_AUTH_PW'] . "\"",$linkID);
while ($row=mysql_fetch_array($result))
{
if (($row['User'] == $_SERVER['PHP_AUTH_USER']) and ($row['Password'] == $_SERVER['PHP_AUTH_PW']))
{
echo "<html><head>";
echo "<title>Autentificare</title>";
echo "</head><body>";
echo "<p>Salut <b><i>{$_SERVER['PHP_AUTH_USER']}</ I></B>!";
echo "<p>Parola introdusa este <b><i>{$_SERVER['PHP_AUTH_PW']}</i></b>.";
echo "</body></html>";
}
else {
echo "<html><head>";
echo "<title>Autentificare</title>";
echo "</head><body>";
echo "<p>Parola introdusa este <b><i>gresita</i></b>.";
echo "</body></html>";
}
}
mysql_close($linkID);
}
?>
PS: Abia am inceput sa invat PHP asa ca va rog sa imi iertati nestiinta.
Oare sa fie din cauza password-ului care este criptat in BD? Sau pt ca nu exista o cheie primara unica?