Hi ,
i m trying to insert a new user account into the ldap using php . bt i
m getting the following warning and the data is not geting inserted
_____________________________________________________
Warning: ldap_add() [function.ldap-add]: Value array must have
consecutive indices 0, 1, ... in
/home/arun/public_html/globees_webservice/Authentication_Layer/cls.authentication.php
on line 148
Could not add new entry!
______________________________________________________
following is my ldap details
_______________________________________________
openldap2.2
LDPv3
PHP Version 5.1.2
Server: Ubuntu 6.06.1 LTS
Apache2
the ldap is working queit fine with other systems.
________________________________________________________
here i am also inclding the code i was trying ....
____________________________________________________________________________
function addUser($username,$password){
$dn = "uid=arun,ou=People,dc=globees,dc=com";
$pass = 'arun';
$ds=ldap_connect('localhost'); // must be a valid LDAP server!
$session_id = '';
$error_status = '-';
if ($ds) {
if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3))
$error_status = "Failed to set protocol version 3";
[EMAIL PROTECTED]($ds,$dn,$pass);
if ($r == TRUE)
{
////
//do insertion
$dn = "uid=testarun,ou=People,dc=globees,dc=com";
$entry["uid"] = "testarun";
$entry["cn"] = "testarun";
$entry["sn"] = "test";
$entry['mail'] = "[EMAIL PROTECTED]";
$entry['objectClass'][0] = "inetLocalMailRecipient";
$entry['objectclass'][1] = "person";
$entry['objectclass'][2] = "organizationalPerson";
$entry['objectclass'][3] = "inetOrgPerson";
$entry['objectClass'][4] = "posixAccount";
$entry['objectClass'][5] = "top";
$entry['objectClass'][6] = "shadowAccount";
$entry["gidnumber"] = 100;
$entry['homeDirectory'] = "/home/arun";
$entry['gecos'] = "testarun";
$entry['loginShell']= '/bin/bash';
$entry['userPassword']='{MD5}' .
base64_encode(pack('H*',md5("testarun")));
$f = ldap_add($ds, $dn, $entry) or die("Could
not add new entry!");
if($f==TRUE) //return a success mesage if
insertion successful
echo "successfully added";
////////////////////
}
elseif ($r == FALSE)
$error_status = "Access Denied!!!";
else
$error_status = "LDAP ERROR!";
}
else
$error_status = "Connection Error";
return $error_status;
}//end of method
_________________________________________________________________________
if anybody has some possible solutions to solve this problem plzz....
give me a reply
--
Regards,
...Arun
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php