LDAP newb gets errors against 2003 AD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So here is the offending code:

--------------------------------------------------
<?PHP
$ldaprdn = 'USR@xxxxxxxxxx';
$ldappass = 'PWD';
$ds = 'server.domain.net';
$dn = 'dc=domain,dc=net';
$ldapport = 389;
$ldapconn = ldap_connect($ds, $ldapport)
or die("Could not connect to LDAP server.");

if ($ldapconn)
{
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
if ($ldapbind)
{
echo "LDAP bind successful...";


$filter = "'cn=*Kenney*'";
$fields = array("ou", "mail");
$sr = ldap_search($ds, $dn, $filter, $fields);

$info = ldap_get_entries($ds, $sr);

for ($i=0; $i<$info["count"]; $i++)
{
echo "<br>";
echo "ou: " . $info[$i]["ou"][0];
echo "mail: " . $info[$i]["mail"][0];
}

}
else
{
echo "LDAP bind failed...";
}
}
ldap_close($ldapconn);
?>
----------------------------------------------

Here is the result:
-------------------------------------
LDAP bind successful...
Warning: ldap_search(): supplied argument is not a valid ldap link
resource in e:\intertest\test.php on line 20

Warning: ldap_get_entries(): supplied argument is not a valid ldap
link resource in e:\intertest\test.php on line 22
------------------------------------------

I know I'm just misusing the ldap_search() function or something, so
please, someone set me straight here.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux