Re: [PHP-DB] Re: Need help with HTTP-Authentication

2002-10-15 Thread BAROILLER

Ok.
It may works with some "little" correction :

in you function CheckPwd...
You get loginname,password in your query but, you look at loginnaam and
passwod in your $sql array..
one of theses :loginname or loginnaam is not the good field :)
after this, you check if user OR password ...
It would be better to check user AND password

So, function may look like this :

function CheckPwd($user,$pass)
{
//Open database connectie
include("scripts/db_connect.php");
//Maak query
$sql_query = "SELECT DISTINCT loginnaam, 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'];

//Sluit database connectie
mysql_free_result($sql_id);
mysql_close($link);
return ($user == $username && $pass == $password) ? true :  true;
}

An other thing, you may not need to open & close your mysql connection in
the function, simply open it at the beginning of your script.
And, for testing, don't forget that you need to close all your browser
window each time ( browser keep information into memory when an
authentication is done).

Regards,
P.E.B


> 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:



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




RE: [PHP-DB] Re: Need help with HTTP-Authentication

2002-10-15 Thread Davy Obdam

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: 



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