PHPLIB and Auth

From: Date: Mon, 19 Mar 2001 09:25:46 +0000
Subject: PHPLIB and Auth
Groups: php.general 
Request: Send a blank email to php-general+get-44507@lists.php.net to get a copy of this message
Hi Guys, I really have a stupid problem but I don't see it :). I wanted to implement authentification with PHPLIB but it seems I am not able to get it working. What happens: If I want to access a page which needs authentification I first get the loginform, so far so good, but when I enter a username and password and submit it, I always get the loginform with the message "Invalid username or password try again". First I thought it was because I had badly configured my database, but the example below shows my database wasn't causing the problem. I think the problem is my loginform, but I don't see how. Do I have to make a setting in my php.ini, what is wrong ???? <?php class TIMEKEEPER_AUTH extends Auth{ /* Declare variables */ var $classname="TIMEKEEPER_AUTH"; var $magic="TIMEKEEPER_MAGIC"; var $lifetime=15; //Maximum 15 minutes idle time !!! var $database_class = "TIMEKEEPER_DB"; var $database_table = "auth_user"; function auth_loginform() { global $sess; include("loginform.ihtml"); } function auth_validatelogin() { global $username, $password; if(isset($username)) { $this->auth["uname"]=$username; } $uid = false; $this->db->query(sprintf("select * from %s where ( username = '%s' ) and ( password = '%s' )", $this->database_table, addslashes($username), addslashes($password))); while($this->db->next_record()) { $uid = $this->db->f("user_id"); $this->auth["perm"] = $this->db->f("perms"); } return $uid; } } /* test to see if everyting is working well with db-backend*/ $db = new TIMEKEEPER_DB; $db->query("select count(*) as count from auth_user"); $db->Next_Record(); $count = $db->f("count"); //count gives 2 which is correct SO OK $username="webadmin"; $password="wwwadmin"; $database_table="auth_user"; $db->query(sprintf("select * from %s where ( username = '%s' ) and ( password = '%s' )", $database_table, addslashes($username), addslashes($password))); $db->Next_Record(); $uid = $db->f("user_id"); //uid gives ... which is correct SO OK ---> The must be something wrong with my loginform it does not submit the right values WHY ???? ?>

« previous php.general (#44507) next »