HELP needed... PHP and Active Directory - Page 2
Page 2 of 2 FirstFirst 1 2
Results 16 to 20 of 20

Thread: HELP needed... PHP and Active Directory

  1. #16
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,494
    One more thing: in case you don't have a PHP IDE application, I strongly suggest you use one, it makes troubleshooting much easier - ex forgot a ';' somewhere or some brackets not closed. I love PHP Designer (freeware).
    Protected by Glock. Don't mess with me!

  2. #17
    Registered User
    Join Date
    Nov 2005
    Posts
    6

    Re: Function

    Thanks for your advice about the IDE, the function

    ldap_get_logonhours

    doesn't seems to work properly it resets everything and returns only " 0 "s

  3. #18
    Registered User
    Join Date
    Apr 2015
    Posts
    3
    I know this thread is super old but I'm having the same issue as uchi. Anyone ever figure this out? And if so, can anyone show me an example of the $hrs variable that goes into the ldap_get_logonhours array?

    Thanks!

  4. #19
    Registered User
    Join Date
    Apr 2015
    Posts
    3
    Anyone out there looking for an answer here's what I figured out:


    $eighthourchunks = str_split($hourshex, 2);
    foreach ($eighthourchunks as $chunk){
    $i++;
    $bytes .= strrev(sprintf('%08d',decbin(hexdec('0x' . $chunk))));
    }

    $bytesbegin = substr($bytes, 0, 5);
    $bytesend = substr($bytes, 5);

    $bytes_tz_corrected = $bytesend . $bytesbegin;
    $daysarr = str_split($bytes_tz_corrected, 24);
    $dowMap = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
    $i = 0;
    foreach ($daysarr as $day){
    echo $dowMap[$i];
    echo ' : ' . $day . '<br>';
    $i++;
    }

  5. #20
    Registered User
    Join Date
    Apr 2015
    Posts
    3
    Hopefully I don't piss too many people off for tacking on to this post.. It just seemed like a good idea to keep this all together.

    So I took the data generated from my last post and created a table. I then used javascript to control that table to recreate functionality similar to what we are all used to seeing in Active Directory where the blue cells represent permitted hours and the gray ones are blocked off hours. Javascript then uses AJAX with post method to return the binary data back to php and php uses pack("C", bindec(strrev($chunk))) in a foreach loop to format it correctly for active directory. My only problem is that I intermittently get the error "Server unwilling to perform 53" and I think it's due to the formatting I'm using. Is there something I should tack on to pack("C", bindec(strrev($chunk))) for it to consistently work?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •