LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 22nd, 2010, 01:37 PM
Joćo da Silva Joćo da Silva is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2010
Posts: 4 Joćo da Silva User rank is Corporal (100 - 500 Reputation Level)Joćo da Silva User rank is Corporal (100 - 500 Reputation Level)Joćo da Silva User rank is Corporal (100 - 500 Reputation Level)Joćo da Silva User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 29 m 43 sec
Reputation Power: 0
PHP - Trying to search the AD without sucess

Hello,

I'm new using LDAP with PHP.
I can connect to the server. But I'm trying to look for users at AD without sucess.

My users are not in Users folders. They're organized as follows:
"DC=dc01,DC=com";

The list of users are only inside NORMAL.

I'm trying an anonymous users, but even if try to connect via bind, I have no sucess trying to bind.

That's the php code:


$dn = "DC=dc01,DC=com,OU=CITY,OU=USERS,OU=NORMAL";




$conexao = ldap_connect("ldap://ip_server", 389) or die("Couldn't connect to AD!");
if (!$conexao) {
echo "Problemas ao Conectar";
exit;
}


$bind = ldap_bind($conexao);
if (!$bind) {
echo "Problemas ao fazer o bind";
}


$result = ldap_search($conexao, $dn, "cn=*");

$entries = ldap_get_entries($conexao, $result);
echo "O numero eh: " . $entries["count"];

for ($i=0; $i<$entries["count"]; $i++)
{
echo $entries[$i]["displayname"]
[0]."(".$entries[$i]["l"][0].")<br />";
}

ldap_unbind($bind);

Reply With Quote
  #2  
Old March 24th, 2010, 06:49 PM
ldapswandog ldapswandog is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Location: Charlotte, NC
Posts: 111 ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 18 m
Reputation Power: 8
First AD does not support anonymous BINDs unless explicitly setup to do so.
Second, the DN you have is incorrect
$dn = "DC=dc01,DC=com,OU=CITY,OU=USERS,OU=NORMAL";
should be
$dn = "OU=NORMAL,OU=USERS,OU=CITY,DC=dc01,DC=com";

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > PHP - Trying to search the AD without sucess

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap