How to list AD users using the adldap class .. in php
try
{
$adldap = new adLDAP();
}
catch (adLDAPException $e)
{
echo $e;
exit();
}
$username = $_POST['nome'];
$password = $_POST['senha'];
//authenticate the user
if ($adldap - > authenticate($username, $password))
{
//establish your session and redirect
session_start();
$_SESSION["username"] = $username;
$_SESSION["userinfo"] = $adldap - > user() - > info($username);
print 'conectando';
print 'feito';
foreach($_SESSION["userinfo"] as $te)
{
//print_r($te);
}
$result = $adldap - > user() - > infoCollection($username, array("*"));
echo $result - > displayName; //nesta linha ele mostra o nome do usuario
echo $result - > mail; //aqui mostra o email
}
else
{
print "erro";
}
?>
<form method="POST" action="valida.php" >
<label>Usuario</label><input type="text" name="nome"/>
<label>Senha</label><input type="text" name="senha"/>
<input type="submit" value="Conectar"/>
</form>