#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    2
    Rep Power
    0

    ldap filter issue


    I created a script that connects/binds to an AD server, queries for users/telephone numbers, then disconnects. However, due to our piss-poor administrators being able to setup a network correctly, I have erroneous stuff showing up (resources and such that shouldn't be.)

    Basically, I want to run a search where it lists users who match a part of a username, and ignores any user record where the telephonenumber field is left blank.

    Code:
    $filter="(&(".$sb."=".$brad."*)(!(telephone=' ')))";
    The code there, just shows me all the users that match the first part, but I'm kind of stuck... any ideas??
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    2
    Rep Power
    0
    nevermind... figured it out myself...

    Code:
    $filter="(&(".$sb."=".$brad."*)(!(!(telephonenumber=*))))";
    worked... I have no idea why though...
  4. #3
  5. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    that's correct you have 2 NOT's in it though, only one is needed

    PHP Code:
    $filter="(&(".$sb."=".$brad."*)(!(telephonenumber=*)))"
  6. #4
  7. Chris Larivee
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Littleton, CO
    Posts
    72
    Rep Power
    11
    Yep - you don't need the double (! ...

    BTW - your first query will return all entries that match on the user if the telephone number is not equal to whitespace ...

IMN logo majestic logo threadwatch logo seochat tools logo