Hi There,
> Hi,
>
> a simple question.. :)
> how do you do ?
I am doing fine, thanks ;-). How are u?
> You can use 2 methods :
> with a .htaccess file on your webserver, updated with your
> table fields or a direct authentification with http headers
> and a little bit of php... Tell me more? may be I could help you.
I would like to use PHP.. Well this is the code i have sofar:
<?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)
{
//Open database connectie
include("scripts/db_connect.php");
//Maak query
$sql_query = "SELECT DISTINCT loginname, password FROM
gebruikers WHERE loginnaam='$user'";
//Verstuur query
$sql_id = mysql_query($sql_query, $link) or die("error in
query");
//Resultaat
$sql = mysql_fetch_assoc($sql_id);
$username = $sql['loginnaam'];
$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 cannot get it to work correctly.. I have two users in my
'gebruikers'(means users) table, but i can only login with the first
user. When i try the 2nd user nothing happends. Do u know a solution or
maybe some better http-authenticate script?
Thanks alot:-)
Best regards,
Davy Obdam,
mailto:[EMAIL PROTECTED]
>
> Regards,
> P.E. Baroiller
>
> "Davy Obdam" <[EMAIL PROTECTED]> a �crit dans le message de
> news: 001901c2747e$fa0184a0$[EMAIL PROTECTED]
> > Hi People,.
> >
> > I have a problem with HTTP-Authentication, i have 2 users in my
> > database, and i want both to be able to login. However it
> works, but
> > only the first user is able to login. I Use a MySQL 3.23.xx
> database,
> > PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help
> > would be greatly apreciated. Thanks already;-)Maybe some examples??
> > ;-)
> >
> > Best regards,
> >
> > Davy Obdam,
> > mailto:[EMAIL PROTECTED]
> >
> >
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php