note 16967 added to function.posix-getpwnam
| From: | vision_1967 at hotmail dot com | Date: | Tue, 20 Nov 2001 16:23:10 +0000 |
| Subject: | note 16967 added to function.posix-getpwnam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21067@lists.php.net to get a copy of this message | ||
I needed to get access to the user information to do login/validation via an SSL connection and
encountered the same problem with receiving '*' in the password field. After checking the
documentation on posix_getpwnam, I saw a previous solution involving coding a C program. This was a
bit bulky for me so I came up with my own solution.
Variations on this theme can probably be done to make the solution more programmer/reader friendly,
but the way I did it accomplished the task that I needed to do.
IF the information you need to get from posix_getpwnam comes from a host participating in an NIS
network, you can accomplish the same thing with the following command:
$autharray = split(":",
ypmatch $USER passwd);
(pretty long explanation for such a short solution huh?)
You'll have to get at the fields by their index number ($autharray[0], $autharray[1], ...)
using this method.
To create an associative array that is plug-in compatible with the posix_getpwnam function,
you'll probably need to use the 'list' specifier to do the assignments.
I hope this helps someone.
--S
--
http://www.php.net/manual/en/function.posix-getpwnam.php
http://master.php.net/manage/user-notes.php?action=edit+16967
http://master.php.net/manage/user-notes.php?action=delete+16967
http://master.php.net/manage/user-notes.php?action=reject+16967