windminstreel
Programmer
- Oct 12, 2004
- 3
Hello Everyone
I'm writing a php script to add a user to the ldap server on a linux system.
Now i'm having a problem adding a password in the userPassword attribute. when i add the user, the userPassword Atribute is still blank and i know i'm putting something into the array. can someone help?
Thanks in advance,
Chris
sample of my script:
$new_ldap_user = array();
$new_ldap_user['cn'] = $naam;
$new_ldap_user['uid'] = $naam;
$new_ldap_user['objectclass'][0] = "posixaccount";
$new_ldap_user['objectclass'][1] = "account";
$new_ldap_user['objectclass'][2] = "top";
$new_ldap_user['objectclass'][3] = "shadowaccount";
$new_ldap_user['userpassword'] = $wachwoord;
$new_ldap_user['gidnumber'] = 100;
$new_ldap_user['uidnumber'] = (int) $uidnumber;
$new_ldap_user['homedirectory'] = $homedir;
$new_ldap_user['loginshell'] = $loginshell;
if ($admin != 'on') {
$add_user = ldap_add($ds, "uid=$naam,ou=clients,dc=cdls,dc=intra", $new_ldap_user);
}else{
$add_user = ldap_add($ds, "uid=$naam,ou=admins,dc=cdls,dc=intra", $new_ldap_user);
}
I'm writing a php script to add a user to the ldap server on a linux system.
Now i'm having a problem adding a password in the userPassword attribute. when i add the user, the userPassword Atribute is still blank and i know i'm putting something into the array. can someone help?
Thanks in advance,
Chris
sample of my script:
$new_ldap_user = array();
$new_ldap_user['cn'] = $naam;
$new_ldap_user['uid'] = $naam;
$new_ldap_user['objectclass'][0] = "posixaccount";
$new_ldap_user['objectclass'][1] = "account";
$new_ldap_user['objectclass'][2] = "top";
$new_ldap_user['objectclass'][3] = "shadowaccount";
$new_ldap_user['userpassword'] = $wachwoord;
$new_ldap_user['gidnumber'] = 100;
$new_ldap_user['uidnumber'] = (int) $uidnumber;
$new_ldap_user['homedirectory'] = $homedir;
$new_ldap_user['loginshell'] = $loginshell;
if ($admin != 'on') {
$add_user = ldap_add($ds, "uid=$naam,ou=clients,dc=cdls,dc=intra", $new_ldap_user);
}else{
$add_user = ldap_add($ds, "uid=$naam,ou=admins,dc=cdls,dc=intra", $new_ldap_user);
}