Can it be that my Apache server is not well configured?
I think you have to allow methods like GET and POST ?

 -----Original Message-----
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]] 
Sent:   maandag 19 maart 2001 10:26
To:     PHP Mailing Listl (E-mail)
Subject:        [PHP] PHPLIB and Auth

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

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to