Hi there,.
Originally posted by no1uknowdfw
Davy,
You'll need to post more details here... your code would help...
There is no possible way to understand what's going on without guessing a 1000 times...
I have used this code:
<?php
function authenticate()
{
Header( "WWW-authenticate: basic realm=\"Gastenboek admin pagina\"");
Header( "HTTP/1.0 401 Unauthorized");
echo "U moet een geldinge loginnaam en wachtwoord invoeren om
deze functie te kunnen gebruiken!\n";
exit;
}
function CheckPwd($user,$pass)
{
global $username,$password;
//Open database connectie
include("scripts/db_connect.php");
//Maak query
$sql_query = "SELECT DISTINCT loginname, password FROM users WHERE loginname='$user'";
//Verstuur query
$sql_id = mysql_query($sql_query, $link) or die("error in query");
//Resultaat
$sql = mysql_fetch_assoc($sql_id);
$username = $sql['loginname'];
$password = $sql['password'];
return ($user != $username || $pass != $password) ? false : true;
//Sluit database connectie
mysql_free_result($sql_id);
mysql_close($link);
}
if(!isset($PHP_AUTH_USER))
{
authenticate();
}
elseif(!CheckPwd($PHP_AUTH_USER,$PHP_AUTH_PW))
{
authenticate();
}
?>
I hope u can help me, i dont see much wrong here🙂
Thanks