Avatar of lgduong
lgduong
Flag for United States of America asked on

VBscript LDAP parameter to PHP

I am trying to recreate a script written in vbscript that have this filter for LDAP.  I would like to get in to a PHP version of LDAP filter.

sFilter = "(&(&(|(&(objectCategory=person)(objectSid=*)(!samAccountType:1.1.111.11111.1.1.111:=3))" _
& "(&(objectCategory=person)(!objectSid=*))(&(objectCategory=group)(groupType:1.1.111.11111.1.1.111:=14)))" _
& "(objectCategory=user)(sAMAccountName=" & xUsrNm & ")))"

I am not used to querying for some many parameters.
VB ScriptPHPActive Directory

Avatar of undefined
Last Comment
lgduong

8/22/2022 - Mon
RobSampson

Hi, I'm not really a PHP guy, but I'm pretty sure it would be this
$xUsrNm = "myuser";

$sFilter = "(&(&(|(&(objectCategory=person)(objectSid=*)(!samAccountType:1.1.111.11111.1.1.111:=3))" .
"(&(objectCategory=person)(!objectSid=*))(&(objectCategory=group)(groupType:1.1.111.11111.1.1.111:=14)))" .
"(objectCategory=user)(sAMAccountName=$xUsrNm)))";

Open in new window


Regards,

Rob.
lgduong

ASKER
I've tried that. Still didn't worked. However a much simpler solution for what I needed from ldap was proposed and it worked.  So this is no longer a problem.  Thank you for your help anyway.
ASKER CERTIFIED SOLUTION
lgduong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
lgduong

ASKER
A simpler solution to get what I needed was shared with me by colleague so I did not need further assistance from Experts.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck