Antoine Blanquet
Antoine Blanquet

Reputation: 11

ldap_add(): Unknown attribute in the data

first of all I'm sorry for my English but I have a problem when using the LDAP_ADD function. When I enter the information in my form, I receive as error:

ldap_add(): Unknown attribute in the data.

However, the connection to the AD is well done and I really can't see which parameter is incorrect in my code.

Thank you in advance for your help !

<?php
$prenom=$_POST['prenom'];
$nom = $_POST['nom'];
// on s'authentifie en tant que super-utilisateur, ici, ldap_admin
$r=ldap_bind($ldap_connection, $ldap_username, $ldap_password);

// préparation des données
$cn=$info["cn"]="$nom $prenom";
$info["sn"]="$nom";
$info["givenname"]="$prenom";
$info["displayname"]="$prenom $nom";
$info["name"]="$prenom $nom";
$info["samaccountname"]= "$prenom.$nom";
$info["objectclass"] = "person";


// ajout dans l'annuaire
$r=ldap_add($ldap_connection,"CN=$cn,$dn",$info);
// fermeture de la connexion
ldap_close($ldap_connection);

echo "L'enregistrement a réussi !!!\n";

?>

Upvotes: 0

Views: 94

Answers (1)

Antoine Blanquet
Antoine Blanquet

Reputation: 11

Problem solved, infact I had a variable which was already under the name of "info" in my code above which takes up the information of the user accounts of the AD to display me a table..

So I just changed the name of my info variable for creating an account

Again a simple problem but still present!

Upvotes: 1

Related Questions