"First name",
"sn" => "Last name",
"uidnumber" => "UID",
"gidnumber" => "GID",
"loginshell" => "Login shell",
"homedirectory" => "Home directory",
"mail" => "Email"
);
$ldap_connection = open_ldap_connection();
if (!isset($_POST['username']) and !isset($_GET['username'])) {
?>
$value) {
if ($user[0][$key][0] != $_POST[$key]) {
$to_update[$key] = $_POST[$key];
$user[0][$key][0] = $_POST[$key];
}
}
if (isset($_POST['password']) and $_POST['password'] != "") {
$password = $_POST['password'];
if (!is_numeric($_POST['pass_score']) or $_POST['pass_score'] < 3) { $weak_password = TRUE; }
if (preg_match("/\"|'/",$password)) { $invalid_password = TRUE; }
if ($_POST['password'] != $_POST['password_match']) { $mismatched_passwords = TRUE; }
if (!preg_match("/$USERNAME_REGEX/",$username)) { $invalid_username = TRUE; }
if ( !$mismatched_passwords
and !$weak_password
and !$invalid_password
) {
$to_update['userpassword'] = ldap_hashed_password($password);
}
}
$updated_account = ldap_mod_replace($ldap_connection, $user[0]['dn'] , $to_update);
if ($updated_account) {
?>
Success! The group has been updated.
Success! The group has been updated.
The password wasn't strong enough.
The password contained invalid characters.
The passwords didn't match.
$group) {
if (is_numeric($index) and preg_match("/$USERNAME_REGEX/",$group)) {
array_push($updated_group_membership,$group);
}
}
$groups_to_add = array_diff($updated_group_membership,$currently_member_of);
$groups_to_del = array_diff($currently_member_of,$updated_group_membership);
foreach ($groups_to_del as $this_group) {
ldap_delete_member_from_group($ldap_connection,$this_group,$username);
}
foreach ($groups_to_add as $this_group) {
ldap_add_member_to_group($ldap_connection,$this_group,$username);
}
$not_member_of = array_diff($all_groups,$updated_group_membership);
$member_of = $updated_group_membership;
?>
Success! The group has been updated.