[phplib] blem with Auth / Registering new users From: Guenther Theilen (theilen <email protected>)
Date: 08/13/01

Hi,

I've got problems to get the Auth-Class to register a new user.
When I try to authenticate existing users, everything works fine.
There is a file login.php in which there will the main part take place
laterone (e.g. menu and permission handling) and I've got a file
called loginform.php which has got the formular and checks the user.
Now I've placed a link at the loginform.php pointing to register.php
and I wrote a file registerform.php with the formular to enter the
userdata.
The register.php starts with

---
page_open (array(   "sess" => "Sess",
                    "auth" => "Register"));
---

At the local.inc the Register-Class look like this:

--- class Register extends Auth { var $classname = "Register"; var $lifetime = 15; var $mode="reg"; var $magic="something"; var $database_class = "DB"; var $database_table = "auth_user"; function auth_registerform() { global $sess; global $_PHPLIB; include("path/to/registerform.php"); // it's the right path in my // loal.inc } function auth_doregister() { global $username, $password; $uid = md5(uniqid($this->magic)); $this->db->query(sprintf("Insert ". " into %s ". " (user_id, username, password, perms) ". " VALUES ('$uid', '$username', '$password', 'user')", $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; } }

------

Strangely this works if cookies are disabled at the browser. If cookies are enabled I get the login-form instead of the register-form when I click the register-link.

Anybody any hints?

tia.

Guenther

-- Abbestellen mit Mail an: phplib-unsubscribe <email protected> Kommandoliste mit Mail an: phplib-help <email protected>