server(), $new_dn, $ou);
if ($ret) {
$message = _("New OU created successfully.");
}
else {
$error = _("Unable to create new OU!");
}
}
else $error = _("OU already exists!");
}
// show errormessage if ou is invalid
else {
$error = _("OU is invalid!") . "
" . htmlspecialchars($_POST['newOU']);
}
}
// delete ou, user was sure
elseif (isset($_POST['deleteOU']) && isset($_POST['sure'])) {
$ret = ldap_delete($_SESSION['ldap']->server(), $_POST['deletename']);
if ($ret) {
$message = _("OU deleted successfully.");
}
else {
$error = _("Unable to delete OU!");
}
}
// ask if user is sure to delete
elseif (isset($_POST['deleteOU'])) {
// check for sub entries
$sr = ldap_list($_SESSION['ldap']->server(), $_POST['deleteableOU'], "ObjectClass=*", array(""));
$info = ldap_get_entries($_SESSION['ldap']->server(), $sr);
if ($sr && $info['count'] == 0) {
// print header
include '../main_header.php';
echo '