Re: Auth and user permission levels
| From: | Michael Jansen | Date: | Fri, 07 Feb 2003 22:46:12 +0000 |
| Subject: | Re: Auth and user permission levels | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3660@lists.php.net to get a copy of this message | ||
"Markus Wolff" wrote:
> I'd like to use Auth for allowing access to different
> sections website >
Hi Markus,
I have added some attributes to the auth table like realname,
userlevel etc. Then I wrote a function 'setAdditionalSessionVars()'
which get these Atributes from the table and register as SessionVars.
...
function setAdditionalSessionVars(){
$db = DB::connect($this->dsn);
if (isset ( $_SESSION['auth']['username'] )
$username = $_SESSION['auth']['username'];
$query = "SELECT vorname , nachname, hdz , userlevel, email ";
$query .= "FROM auth WHERE username = '$username' ";
$result = $db->getRow($query,DB_FETCHMODE_ASSOC);
foreach ($result as $k=>$v){
$_SESSION[$k] = $v;
}
return true;
} else {
return false;
}
} // <<<
what is to think about that?
Michael