Heyya
Yeah, the problem is prolly with your syntax.
<?
$_SESSION['name'] = $name->name;
$_SESSION['auth_level'] = $name->auth_level;
?>
Do you realise what you're doing there? $name is a object. No where in your function did you create a object called $name. If $name is an object outside the scope of the login function, then you need to call it explicitly:
<?
$_SESSION['name'] = $this->name->name;
$_SESSION['auth_level'] = $this->name->auth_level;
?>
... but anyway... I don't see the point of doing that. If you're going to use a class, you should at least stick to the object-oriented methodology. There's no real point in creating a session variable inside your class... that doesn't really fit with the OO approach.
I made a Authentication class, and did something similar. I used cookies though instead of sessions. but anyhow, what you should do is just add some extra methods to your Name class or whatever it's actually called.:
function getName(){
return $this->name;
}
function getAuthLevel(){
return $this->auth_level;
}
then instead of calling $_SESSION['name'] just call $name->getName();
well, hope that makes sense.
cya man,
-Adam 🙂