[PHPLIB] validating users??? From: Francisco Sam Castillo (fsam <email protected>)
Date: 01/13/00

Hello,

I am trying to validate a user with and additional element set on it's
record on the database, so the process would be the user enters her/his
username/password combination, and then the auth_validatelogin() function
would go and search for the user existence and such, I tried to insert a new
condition into this function, that searches on the same table for a flag
that makes a user "A" (active) or "I" (inactive), thus if the user is valid
and has a proper record, and has enter username/password combination and has
the status field = to "A" then it's ok login, but if status field = to "I"
then send error message (complain) to her/him and ask them to complete the
registration process, which would set the correct status and validate the
account by responding an email sent by the register form.

Unfortunately even when I have try every possible thing I could come up
with, nothing works, the function just ignores me, please if some one could
help me I would appreciate it a lot as all my registration process depends
on this.

// This is an example of what I did

function auth_validatelogin() {
    global $username, $password, $status, $mode;
    if(isset($username)) {
      $this->auth["uname"]=$username; ## This provides access for
"loginform.ihtml"
    }
    $uid = false;
    $this->db->query(sprintf("select user_id, perms, status ".
                             " from %s ".
                             " where username = '%s' ".
                             " and password = '%s'",
                          $this->database_table,
                          addslashes($username),
                          addslashes($password),
                          addslashes($status)));
    while($this->db->next_record()) {
      $uid = $this->db->f("user_id");
      $this->auth["perm"] = $this->db->f("perms");
      $this->auth["ustatus"] = $this->db->f("status");
    }
    if ($uid == false)
      $this->auth["error"] = "<font size=2>Ya sea tu nombre de usuario o
clave de acceso, no son validos.</font>";

    elseif ($ustatus != "A")
      $this->auth["error"] = "<font size=2>Aun no activas tu cuenta, si este
es el caso, por favor sigue las instrucciones del e-mail que se te envio
para activar tu cuenta e intentalo de nuevo!.</font>";
    else
      SetCookie("auth_username", $username, pow(2, 31)-1, "/");
    return $uid;
 }

Thanks so much in advanced.

BTW to the developers & core team and all who has contribute to this great
library many, many thanks for a wonderful work :)

Sam

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.