AUTH in class
| From: | Adam Hubscher | Date: | Wed, 19 Jan 2005 06:23:41 +0000 |
| Subject: | AUTH in class | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17007@lists.php.net to get a copy of this message | ||
I have recently attempted at utilizing Pear::AUTH in order to provide a login system on a site being used for account management for a game server.
However, I have been usuccessful at implementing it into a class.
For starters, I have been unable to properly call a function to display the login form, unless its in the main page's function list (index.php). I have been unable to call any form display pages from within a class.
Secondly, when I put the form display function within index.php, with it pointing to the login function from within the class - I have been unable to authorize, it continously displays the form.
The current pseudo login function, from within the class, looks as such:
function Login() {
$AuthOptions = array(
'dsn'=> DSN,
'table'=>"tblBillID",
'usernamecol'=>"BillID",
'passwordcol'=>"Password",
);
$this->auth = new Auth("DB",$AuthOptions,"loginFunctionDisplay");
if($this->auth->getAuth()){
print("Success!!");
}
else{
$this->auth->start();
}
}
The simple form:
function loginFunctionDisplay()
{
echo "<form method=\"post\" action=\"/index.php?Module=ToController&Function=Login\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">";
echo "</form>";
}
I have placed loginFunctionDisplay() in both index.php and the Controller class. The only way I was able to provide the form's display was through index.php.
My question is this:
Is it possible to implement this into a class? I was having very slight difficulty with QuickForm implenting correctly, however I managed to fix it with a very simple resolution - and I have attempted that same resolution here. Nothing has worked.
Thanks in advance!