Groups > Novell > Novell NetWare with PHP > Re: bin2hex doesn't work as i want




Re: bin2hex doesn't work as i want

Re: bin2hex doesn't work as i want
Tue, 29 Aug 2006 14:05:49 GMT
I have the same Problem - bin2h3ex does not work if the mac-address 
contains '00'.

if i try to use ldap_get_values_len() i get the following error:

Warning: ldap_get_values(): Cannot get the value(s) of attribute Decoding 
error in /var/w...

Here is my Code:							
$ldap_result2=ldap_search($ldap,$base_dn,'objectClass=*',array('dnipmacaddress')
);
$erster=ldap_first_entry($ldap,$ldap_result2 );
$mac=ldap_get_values($ldap,$erster,'dnipmacaddress');

Thanks, Michael Fischer

> $ds=ldap_connect(LDAP_SERVER);
> if ($ds)
> {
>    $r=ldap_bind($ds,$admin, $pwd);
>    $sr=ldap_search($ds,"ou=company, o=country",
"cn=ff_ff_ff_ff");
>    $entry = ldap_first_entry($ds, $sr);
>    $attr = ldap_get_values_len($ds,$entry,"dNIPMACAddress");
>    echo bin2hex($attr[0]);
>    ldap_close($ds);
> }
> 
> Indeed, it works...
> Thanks Jim but i've done a UCS/UCX solution now.
> 
> François
> 
> "Jim Lawson" <lawsonj1@westat.com> a écrit dans le message
de
> news:9Kocc.20228$jb5.1979@prv-forum2.provo.novell.com...
> > ldap_get_attributes() does not handle binary data. You have to use
> > ldap_get_values_len().
> >
> > (I also use a php/ldap driven web page to search and display DHCP 
records.
> > The helpdesk loves it.)
> >
> > - Jim
> >
> > "François Lumineau" <flumineau@iae.univ-poitiers.fr>
wrote in message
> > news:Itbbc.16842$jb5.8776@prv-forum2.provo.novell.com...
> > > Hi all !
> > > I'd like to read the Mac Address recorded of the Pcs recorded on
my
> Novell
> > > DHCP server.
> > > Here is my configuration and my simple code to do this :
> > >
> > > NW 6.5
> > > Apache 2.0.48
> > > PHP 4.2.4
> > >
> > >
> > > $ds=ldap_connect(DHCP_Server);
> > >  if ($ds){
> > >    $r=ldap_bind($ds, $admin , $pwd);
> > >    $sr=ldap_search($ds,"ou=company, o=country",
"cn=PC");
> > >    $info = ldap_first_entry($ds, $sr);
> > >    $attrs = ldap_get_attributes($ds, $info);
> > >    echo bin2hex($attrs[$attrs[7]][0])."<br>"; //
where
> > $attrs[$attrs[7]][0]
> > > corresponds to the Mac address attribute
> > > }
> > >
> > > If the Mac Adress is like 11:22:33:44:55:66, there's no problem,
i 
get
> > > 112233445566
> > > but if there's a "00" (as 11:22:00:33:44:55), il
interprets it as 
the
> end
> > of
> > > the attribute. So it give me just 1122
> > >
> > > If someone have an idea.
> > > Thanks....
> > > -- 
> > > ---------- 
> > > François LUMINEAU (flumineau@iae.univ-poitiers.fr)
> > > IAE Poitiers - Service Informatique
> > > BP 639 - 20 rue G. VII le Troubadour - 86022 POITIERS Cedex
> > > Tél. : 05 49 45 41 45 - Fax : 05 49 45 44 90
> > > http://www.iae.univ-poitiers.fr - http://www.univ-poitiers.fr
> > >
> > >
> >
> >
> 
> 
Post Reply
about | contact