Re: [PHPLIB] auth_validatelogin() From: Bryan McGuire (joefriday <email protected>)
Date: 12/09/99

I was wrong!!!!

The problem with switching modes between "reg" and "log" is that $auth->mode
isn't persistant. If you change the mode and force it to do
auth_registerform() , it still gets submitted back to auth_validatelogin()
instead of auth_doregister(). I finally did get it to work the way I
expected, but I had to modify setup() in auth.inc like this:

      $this->db = new $class;
    }
////////////////////// these lines added by Bryan McGuire
    if (!isset($this->auth["mode"])) $this->auth["mode"]="log"; #default is
"log"
    $this->mode=$this->auth["mode"];
////////////////////// end of modification.
    # Check current auth state. Should be one of

I also added the following line to the end of unauth():

    $this->auth["mode"]="log";

In the beginning of my auth_validatelogin() I have the following code to
check whether the registration form needs to be drawn:

if ($new=="yes")

      $this->unauth();
      $this->nobody = false;
      $this->auth["mode"] = "reg";
      $this->start();
    }

And at the end of my auth_doregister() I have it do this before returning
the uid.

$this->auth["mode"] = "log";

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