fetch email address from nis authentication

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vamsi_j
Forum Newbie
Posts: 5
Joined: Tue Jan 02, 2007 6:49 am

fetch email address from nis authentication

Post by vamsi_j »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


from an NIS authentication i would like to fetch the email address.
can anyone help me.

i have written a function to fetch the full name of the person associated with thatuser
similarly i need it for emailaddress.

Code: Select all

getUserByName($user)
{
 
   $fullname = yp_match (yp_get_default_domain(), "passwd.byname", $user);
   if ( ! empty ( $fullname ) ) {
       $fullname = explode ( ":", $fullname );
        return $fullname[4];
      } else {
         return $user;
    }
}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

There are mail.aliases and mail.byaddr as maps for /etc/aliases
Post Reply