note 21435 added to function.posix-getgrgid
| From: | tech at dslip dot com dot au | Date: | Mon, 13 May 2002 10:27:04 +0000 |
| Subject: | note 21435 added to function.posix-getgrgid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30576@lists.php.net to get a copy of this message | ||
okies...
This code should be considered as an OPTION only, it works under MY set of circumstances, and that
is all I intended. The below funtion will return the NAME of the GROUP if provided with the Group
ID#
function RC_posix_getgrgid($gid)
{
$LocationGroup = "/etc/group"; //EDIT THIS IF YOU HAVE A DIFFERENT OS. mine = debian
$fp = fopen ("/etc/group","r");
while ($groupinfo = fscanf ($fp, "%[a-zA-Z0-9]:x:%[0-9]:%[a-zA-Z0-9]\n"))
{
list ($name, $groupID, $nfi) = $groupinfo;
if ($groupID == $gid)
{
$returnval = $name;
}
}
fclose($fp);
if($returnval) { return $returnval; } else { return 0; }
}
--
http://www.php.net/manual/en/function.posix-getgrgid.php
http://master.php.net/manage/user-notes.php?action=edit+21435
http://master.php.net/manage/user-notes.php?action=delete+21435
http://master.php.net/manage/user-notes.php?action=reject+21435