2 require_once('../lib/ldap/functions.php3');
4 $ds = @ldap_connect($config[ldap_server]);
7 $r = @da_ldap_bind($ds,$config);
9 list ($givenname,$sn) = split(' ',$Fcn,3);
10 $dn = 'uid=' . $login . ',' . $config[ldap_default_new_entry_suffix];
11 $new_user_entry["objectclass"][0]="top";
12 $new_user_entry["objectclass"][1]="person";
13 $new_user_entry["objectclass"][2]="organizationalPerson";
14 $new_user_entry["objectclass"][3]="inetOrgPerson";
15 $new_user_entry["objectclass"][4]="radiusprofile";
16 $new_user_entry["cn"]="$Fcn";
17 $new_user_entry["sn"]="$sn";
18 $new_user_entry["givenname"]="$givenname";
19 $new_user_entry["mail"]="$Fmail";
20 $new_user_entry["telephonenumber"]="$Ftelephonenumber";
21 $new_user_entry["homephone"]="$Fhomephone";
22 $new_user_entry["mobile"]="$Fmobile";
23 $new_user_entry["ou"]="$Fou";
24 $new_user_entry["uid"]="$login";
25 if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
26 include("../lib/crypt/$config[general_encryption_method].php3");
27 $passwd = da_encrypt($passwd);
28 $new_user_entry[$attrmap['User-Password']] = '{' . "$config[general_encryption_method]" . '}' . $passwd;
31 echo "<b>Could not open encryption library file.Password will be clear text.</b><br>\n";
32 $new_user_entry[$attrmap['User-Password']]="{clear}" . $passwd;
35 print_r($new_user_entry);
37 @ldap_add($ds,$dn,$new_user_entry);
39 foreach($show_attrs as $key => $attr){
40 if ($attrmap["$key"] == 'none')
43 // if value is the same as the default and the corresponding attribute in ldap does not exist or
44 // the value is the same as that in ldap then continue
46 if ( check_defaults($$attrmap["$key"],'',$default_vals["$key"]))
48 if ( $$attrmap["$key"] == '')
50 $mod[$attrmap["$key"]] = $$attrmap["$key"];
52 @ldap_mod_add($ds,$dn,$mod);
55 if (@ldap_error($ds) == 'Success')
56 echo "<b>User was added in user database</b><br>\n";
58 echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";