Hi,

> I need the user's name to display "Welcome Mr/Mrs XXX" on the 
> main page when 
> s/he logged in

NemeinAuth returns the id of the user if login was successfull.
You can then use mgd_get_person($returned_id); to address your
Customer...
Use of nemein_auth is pretty easy,
This is the code I use for login (in style, no midcom here though..):
--------snip------
// Include the NemeinAuthentication library
mgd_include_snippet("/Nemein_Authentication/Init");
$user=0;
if($logout) {
    // Log user out and redirect to root page
    auth_logout();
    header("location: /");
}

elseif($login) {
    // Create the authentication session
    $result=auth_login($username,$password);
    if($result) {
        echo $result;
    }
    else{
        // Login was successful, get user information
        $user=mgd_get_person($midgard->user);
    }
}

else{
    // Refresh existing session from user's cookies
    $login_error=auth_by_cookies();
    if(!$login_error) {
        // Session validated, get user information
        $user=mgd_get_person($midgard->user);
    }
}

if($user){
// User found, show page content
?>
 <[head]>
 <[body]>
<?
}
else {
   // show login screen
?>
<[head]>
<[login]>
<?
}
?>
--------snap--------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to