after checking user login/password in case of successful validation we create instance of something like this:
class User {
var $id;
var $some_user's_data
function User ($in){
$this->id = $in['user_id'];//which we use to differentiate users
$this->$some_user's_date = $in['some data'];
}
}
//in login.php in case of successful login
session_start();
session_register("user");
$user = new User($in);
//in any other script to authenticate user will do: session_start();
if ($user->id) {
//we are authenticated
} else {
//we are not authenticated
}
So. Actually authentication is based upon detecting if a user have valid PHPSESSID which maps to proper class structure on the server.
What'd you think?