note 111899 added to function.ldap-get-values-len
| From: | ashwini at majestik dot net | Date: | Tue, 09 Apr 2013 22:52:56 +0000 |
| Subject: | note 111899 added to function.ldap-get-values-len | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194416@lists.php.net to get a copy of this message | ||
Just a minor update to the note below from "jhgustafsson" regarding the
"objectGUID" field...
Going a step further, sometimes its useful to display this GUID as a String, and Microsoft has a
support article and script detailing how to convert objectGUID from Hex to String. That article is
here: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B325649
Below is a PHP function that does the same thing as Microsoft's VB script, it takes input of
objectGUID in binary format and returns it formatted as a string (after converting it to Hex as a
middle step). This will return the exact "objectGUID" value that is displayed for any
Active Directory object in ADUC.
Example output: 3f79048f-42cd-4c77-8426-835cd9f8a3ad
function GUIDtoStr($binary_guid) {
$hex_guid = unpack("H*hex", $binary_guid);
$hex = $hex_guid["hex"];
$hex1 = substr($hex, -26, 2) . substr($hex, -28, 2) . substr($hex, -30, 2) . substr($hex, -32, 2);
$hex2 = substr($hex, -22, 2) . substr($hex, -24, 2);
$hex3 = substr($hex, -18, 2) . substr($hex, -20, 2);
$hex4 = substr($hex, -16, 4);
$hex5 = substr($hex, -12, 12);
$guid_str = $hex1 . "-" . $hex2 . "-" . $hex3 . "-" . $hex4 .
"-" . $hex5;
return $guid_str;
}
----
Server IP: 69.147.83.199
Probable Submitter: 216.52.12.243
----
Manual Page -- http://php.net/manual/en/function.ldap-get-values-len.php
Edit -- https://master.php.net/note/edit/111899
Del: integrated -- https://master.php.net/note/delete/111899/integrated
Del: useless -- https://master.php.net/note/delete/111899/useless
Del: bad code -- https://master.php.net/note/delete/111899/bad+code
Del: spam -- https://master.php.net/note/delete/111899/spam
Del: non-english -- https://master.php.net/note/delete/111899/non-english
Del: in docs -- https://master.php.net/note/delete/111899/in+docs
Del: other reasons-- https://master.php.net/note/delete/111899
Reject -- https://master.php.net/note/reject/111899
Search -- https://master.php.net/manage/user-notes.php