Link to home
Start Free TrialLog in
Avatar of lgduong
lgduongFlag 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.
Avatar of RobSampson
RobSampson
Flag of Australia image

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.
Avatar of 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
Avatar of lgduong
lgduong
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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.