Hiya people, I am building a admin page for a guestbook and i want more people to be able to log in. I have made a table in the database called user(gebruikers) wich keeps both a loginname(loginnaam) and password. I have 2 users in this table right now. Now i ve a problem.. I can login with the first person (myself), but i am unable to login with the second user. Here is my code, i hope someone can help me..:)
<?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 loginnaam, wachtwoord 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['wachtwoord']; 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(); } ?> Thanks already.. Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php