Auth, "problem" registering additional data
| From: | Jeroen Houben | Date: | Fri, 13 Dec 2002 11:15:50 +0000 |
| Subject: | Auth, "problem" registering additional data | ||
| Groups: | php.pear.dev php.pear.general | ||
| Request: | Send a blank email to pear-dev+get-11603@lists.php.net to get a copy of this message | ||
I want to register the userID with $myAuth which is an instance of the
Auth class. see below
$myAuth = new Auth('DB', $params, 'loginFunction', true);
$myAuth->start();
$result = mysql_query('SELECT ID FROM users WHERE
username="'.$myAuth->getUsername().'"') or print mysql_error();
$userID = mysql_result($result,0);
$myAuth->setAuthData(array("userID"=>($userID)));
$myAuthData = $myAuth->getAuthData('totally unrelated string');
$userID = $myAuthData['userID'];
I don't quite understand how setAuthData and getAuthData work. The
example above works, but I don't understand why I _have_ to pass a
string to getAuthData. shouldn't $myAuth->getAuthData() just return an
associative array with all the extra data I have registered with the
session? I think I must be doing something wrong, how do other people
use these functions?
Jeroen