Discussion:
LDAP PHP and logonHours
(too old to reply)
Steve Board
2004-10-13 07:11:53 UTC
Permalink
Can anyone help please.

I am trying to make use of the loginHours that are part of active
directory. The problem is I am trying to access this field from PHP
Version 5.

The problem I am having is that when I call an AD object, I get all
the data you would expect, however the logonHours do not always come
back; Or if they do they are not the same as that shown in thd LDIF
export file (I use this as my reference).

When and if I do succeed in getting the right data back, can anyone
tell me how to decode this back to times / days. I am sure I could
reverse engineer this data, given time, but if someone has already
done it, I would be most grateful.

I should be most grateful for any help regarding these items.

Steve B
deKay
2004-10-13 07:56:26 UTC
Permalink
Soni tempori elseu romani yeof helsforo nisson ol sefini ill des 13 Oct 2004
00:11:53 -0700, sefini jorgo geanyet des mani yeof do uk.education.schools-it,
Post by Steve Board
The problem I am having is that when I call an AD object, I get all
the data you would expect, however the logonHours do not always come
back; Or if they do they are not the same as that shown in thd LDIF
export file (I use this as my reference).
Can't help you here, I'm afraid...
Post by Steve Board
When and if I do succeed in getting the right data back, can anyone
tell me how to decode this back to times / days. I am sure I could
reverse engineer this data, given time, but if someone has already
done it, I would be most grateful.
I should be most grateful for any help regarding these items.
Can you give an example of what form the data is in?
Tim Howarth
2004-10-13 14:17:02 UTC
Permalink
Post by Steve Board
The problem I am having is that when I call an AD object, I get all
the data you would expect, however the logonHours do not always come
back; Or if they do they are not the same as that shown in thd LDIF
export file (I use this as my reference).
When and if I do succeed in getting the right data back, can anyone
tell me how to decode this back to times / days. I am sure I could
reverse engineer this data, given time, but if someone has already
done it, I would be most grateful.
Logonhours is a 21 byte value with each bit representing 1 hour of the
week (i.e 3 bytes per 24hr day).

Unless PHP has some special variable type for handling 21 byte numbers
you'll have to play at bit setting and passing a block of data to the
user object.

I can give examples in Python and VB but not unfortunately in PHP.
--
___
|im ---- ARM Powered ----
Geoffrey King
2004-10-13 14:29:29 UTC
Permalink
Post by Tim Howarth
Post by Steve Board
The problem I am having is that when I call an AD object, I get all
the data you would expect, however the logonHours do not always come
back; Or if they do they are not the same as that shown in thd LDIF
export file (I use this as my reference).
When and if I do succeed in getting the right data back, can anyone
tell me how to decode this back to times / days. I am sure I could
reverse engineer this data, given time, but if someone has already
done it, I would be most grateful.
Logonhours is a 21 byte value with each bit representing 1 hour of the
week (i.e 3 bytes per 24hr day).
Unless PHP has some special variable type for handling 21 byte numbers
you'll have to play at bit setting and passing a block of data to the
user object.
I can give examples in Python and VB but not unfortunately in PHP.
http://uk2.php.net/gmp

<?php
function isBitSet($bitMask, $bitMap)
{
return (bool) gmp_intval(gmp_div(gmp_and($bitMask, $bitMap),$bitMask));
}
?>

Should be enough to get you going. :)
--
"Linux: the operating system with a CLUE...
Command Line User Environment".
(seen in a posting in comp.software.testing)
Loading...