note 78588 added to function.ldap-get-attributes

From: Date: Thu, 18 Oct 2007 09:52:02 +0000
Subject: note 78588 added to function.ldap-get-attributes
Groups: php.notes 
Request: Send a blank email to php-notes+get-131489@lists.php.net to get a copy of this message
I spent quite a while scratching my head about how to read operational attributes such as create and modify timestamps. This function solved it.... function get_entry_system_attrs( $ds, $dn, $deref=LDAP_DEREF_NEVER ) { $conn = $ds; $attrs = array( 'creatorsname', 'createtimestamp', 'modifiersname', 'structuralObjectClass', 'entryUUID', 'modifytimestamp', 'subschemaSubentry', 'hasSubordinates', '+' ); $search = @ldap_read( $conn, $dn, '(objectClass=*)', $attrs, 0, 0, 0, $deref ); if( ! $search ) return false; $entry = ldap_first_entry( $conn, $search ); if( ! $entry) return false; $attrs = ldap_get_attributes( $conn, $entry ); if( ! $attrs ) return false; if( ! isset( $attrs['count'] ) ) return false; $count = $attrs['count']; unset( $attrs['count'] ); $return_attrs = array(); for( $i=0; $i<$count; $i++ ) { $attr_name = $attrs[$i]; unset( $attrs[$attr_name]['count'] ); $return_attrs[$attr_name] = $attrs[$attr_name]; } return $return_attrs; } ---- Server IP: 69.147.83.197 Probable Submitter: 195.173.57.160 ---- Manual Page -- http://www.php.net/manual/en/function.ldap-get-attributes.php Edit -- https://master.php.net/note/edit/78588 Del: integrated -- https://master.php.net/note/delete/78588/integrated Del: useless -- https://master.php.net/note/delete/78588/useless Del: bad code -- https://master.php.net/note/delete/78588/bad+code Del: spam -- https://master.php.net/note/delete/78588/spam Del: non-english -- https://master.php.net/note/delete/78588/non-english Del: in docs -- https://master.php.net/note/delete/78588/in+docs Del: other reasons-- https://master.php.net/note/delete/78588 Reject -- https://master.php.net/note/reject/78588 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131489) next »