DB::ldap
| From: | joel dot de dot vahl at arrowhead dot se | Date: | Tue, 02 Jul 2002 11:53:59 +0000 |
| Subject: | DB::ldap | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1785@lists.php.net to get a copy of this message | ||
Hi,
I have some problems with DB::ldap. I can remove and search entries just like I
should, but adding won't work. Can anyone see what's wrong here, or is it a bug
in DB::ldap (shoulden't be, right? :)?
The code follows:
if($_POST["choice"] == "ADD"){
include_once("pear/DB.php");
include_once("dbsettings.php");
$dsninfo = array("username" => cn=Admin,
"password" => "mypass",
"hostspec" => "my.host",
"port" => 389,
"database" => "o=Internet",
"phptype" => "ldap",
"protocol" => false);
$db =& DB::connect($dsninfo);
if(DB::isError($db)){
die($db->getMessage());
}
$query = "dn=" . $_POST["dn"];
$entry = array("dn=" . $_POST["dn"], "dc" =>
$_POST["dc"],
"objectclass" => array("top", "domain"));
$result = $db->query($query, $entry, "add");
if(DB::isError($result)){
die($result->getMessage());
}
$result->free();
$db->disconnect();
}
else{
include_once("pear/HTML/Form.php"); $form =& new
HTML_Form($PHP_SELF, "POST", "add");
$form->start();
echo("<table>");
$form->displayTextRow("dn", "DN");
$form->displayTextRow("dc", "DC");
$form->displayHidden("choice", "ADD");
$form->displaySubmitRow("submit", "Add");
echo("</table>");
$form->end();
}
/joel de vahl