<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
require_once('/include/adLDAP.php');
$adldap = new adLDAP();
$username = "user123";
$password = "pass123";
$authUser = $adldap->authenticate($username, $password);
if ($authUser === true) {
echo "<p>User authenticated successfully</p>";
}
else {
echo "User authentication unsuccessful";
}
$result=$ldap->user_groups($username);
print_r($result);
?>
I am using this class http://adldap.sourceforge.net/ and authentication works fine, but it gives me the following error:
Notice: Undefined variable: ldap in /web/protected/protected.php on line 18
Fatal error: Call to a member function user_groups() on a non-object in /web/protected/protected.php on line 18
Line 18 is:
$result=$ldap->user_groups($username);
Never used this class before, so I am unsure of why it is giving me that error, any help is appreciated.