Re: [Phplib-users] Basic authentication (fwd)
Brought to you by:
nhruby,
richardarcher
From: Carl Y. <ca...@yo...> - 2002-02-03 11:04:46
|
Thanks! The preauth() was the part I was missing. FYI for those of you implementing this, you'll also want to override the $auth->logout() function so that it deletes the "rememberme" cookies, or else the user will never be able to log out! Carl ----- Original Message ----- From: "Tarique Sani <ta...@sa...>" <ro...@sa...> To: <php...@li...> Sent: Saturday, February 02, 2002 9:54 PM Subject: Re: [Phplib-users] Basic authentication (fwd) > > -- > ========================================================== > PHP Applications for E-Biz : http://www.sanisoft.com > > The Ultimate Ghazal Lexicon: http://www.aaina-e-ghazal.com > ========================================================== > ---------- Forwarded message ---------- > Date: Sun, 3 Feb 2002 10:22:20 +0530 (IST) > From: "Tarique Sani <ta...@sa...>" <ro...@bo...> > To: Carl Youngblood <ca...@yo...> > Cc: "Phplib (E-mail)" <Php...@li...> > Subject: Re: [Phplib-users] Basic authentication > > On Sat, 2 Feb 2002, Carl Youngblood wrote: > > > Yeah, I would like some code samples if you don't mind. I added code to my > > auth_validatelogin() function to set the cookie with the userid in it, but > Here are the relevant code snippets, note that you will have to implement > "Forget Me" functionality separately > > ================================ > function auth_preauth(){ > > global $uidcookie; > > $uid= false; > > > $this->db->query(sprintf("select * > from %s > where uid = '%s' ", > $this->database_table, > $uidcookie)); > > while($this->db->next_record()) { > $uid = $this->db->f("uid"); > $this->auth["uname"]=$this->db->f("username"); > $this->auth["email"]=$this->db->f("email"); > $this->auth["name"]=$this->db->f("name"); > $this->auth["perm"] = $this->db->f("perms"); > $this->auth["classid"]=$this->db->f("classid"); > } > return $uid; > } > > function auth_validatelogin(){ > global $username, $password, $remind_me; > > if(isset($username)) { > $this->auth["uname"]=$username; ## This provides access for > "loginform.ihtml" > } > > $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("uid"); > $this->auth["uname"]=$this->db->f("username"); > $this->auth["email"]=$this->db->f("email"); > $this->auth["name"]=$this->db->f("name"); > $this->auth["perm"] = $this->db->f("perms"); > $this->auth["classid"]=$this->db->f("classid"); > if (isset($remind_me)){ > $this->auth["remind_me"]="yes"; > setCookie("uidcookie",$uid,time()+31536000); > > } > > } > return $uid; > } > } > ========================== > -- > ========================================================== > PHP Applications for E-Biz : http://www.sanisoft.com > > The Ultimate Ghazal Lexicon: http://www.aaina-e-ghazal.com > ========================================================== > > > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users |