require(”empdir_common.php”); require(”empdir_functions.php”); At least, the name, e-mail, and
require(”empdir_common.php”); require(”empdir_functions.php”); At least, the name, e-mail, and department information should be entered. If this is not entered, we display an error and re-display the earlier form: if (!$cn || !$mail || !$ou) { generateHTMLHeader(”Please fill in fields: “); displayErrMsg(”Minimally Name, Dept. and E-mail fields are required!!”); generateHTMLForm(0, “empdir_add.php”, “ADD”); } else { We collect the attributes of the new entry to be added in an associative array: $entryToAdd[”cn”] = $cn; $entryToAdd[”sn”] = $sn; $entryToAdd[”mail”] = $mail; $entryToAdd[”employeenumber”] = $employeenumber; $entryToAdd[”ou”] = $ou; $entryToAdd[”telephonenumber”] = $telephonenumber; $entryToAdd[”objectclass”] = “person”; $entryToAdd[”objectclass”] = “organizationalPerson”; $entryToAdd[”objectclass”] = “inetOrgPerson”; Here we construct the DN corresponding to the new entry: $dnString = “mail=” . $mail . “,” . “ou=”. $ou . “,” . $baseDN; This is the root DN we shall bind to, before performing the add operation: $adminRDN = “cn=Admin,” . $baseDN; We connect to the server and bind as an administrator: $linkIdentifier = connectBindServer($adminRDN, $adminpassword); if ($linkIdentifier) { The actual addition is done here: if (ldap_add($linkIdentifier, $dnString, $entryToAdd) == true) { generateHTMLHeader(”The entry was added succesfully”); returnToMain(); } else { displayErrMsg(”Addition to directory failed !!”); closeConnection($linkIdentifier); returnToMain(); exit; Page 522
Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services