PhP & Ldap : Undefined attribute type
Hello,
I'm trying to add ldap entries from a csv-file, like this : while (!feof($file_handle) ) { $line_of_text = fgetcsv($file_handle, 1024); if ($line_of_text[0]!="" || $line_of_text[1]!="") { $name=$line_of_text[0]; $telephone=$line_of_text[1]; $info["cn"] = $name; $info["sn"] = $name; $info["telephonenumber"] = $telephone; $info["objectclass"] = "inetOrgPerson"; $r2 = ldap_add($ds, "cn=$name,ou=contacts,ou="domain",dc=tld", $info); echo "Add result is " . $r2 . "<br>"; echo("msg: '".ldap_error($ds)."'<br>"); } # if } # while fclose($file_handle); I'm always getting the output : Add result is msg: 'Undefined attribute type' All goes well when I add just one entry : Mar 23 21:45:18 vps slapd[25734]: conn=1254 op=1 ADD dn="cn=Coll X,ou=contacts,ou=domain,dc=tld" Mar 23 21:45:18 vps slapd[25734]: conn=1254 op=1 RESULT tag=105 err=0 text= But when I want to add multiple entries in a loop-statement, then : Mar 23 21:53:10 vps slapd[25734]: conn=1258 op=6 ADD dn="cn=Coll X,ou=contacts,ou=domain,dc=tld" Mar 23 21:53:10 vps slapd[25734]: conn=1258 op=6 RESULT tag=105 err=17 text=dirname: attribute type undefined Anyone an idea about this "attribute type undefined" ?? |
Suggestions:
1. Please make sure your double- and single-quotes all balance, and you have "$" on all your variables. Especially: Code:
$r2 = ldap_add($ds, "cn=$name,ou=contacts,ou="domain",dc=tld", $info); |
Quote:
Code:
$r2 = ldap_add($ds, "cn=$name,ou=contacts,ou=".$domain.",dc=tld", $info); Why does ldap not accept multiple add-statements ? Should I disconnect and re-connect before every add-operation ?! I've read somewhere about adding an "end-of-line" because ldap wants every entry on a new line. Is this not the case here ? |
It appears to be a very very very stupid question.
Apparently I already had somewhere a variable $info[], so the different attributes of the ldap_add where scrambled. Thanks for feedback. |
All times are GMT -5. The time now is 01:27 PM. |