public function createLdapEntry($attributes, $dn = NULL) {

    if (!$this->connection) {
      $this->connect();
      $this->bind();
    }
    if (isset($attributes['dn'])) {
      $dn = $attributes['dn'];
      unset($attributes['dn']);
    }
    elseif (!$dn) {
      return FALSE;
    }

    $result = @ldap_add($this->connection, $dn, $attributes);
    if (!$result) {
      $error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
      debug(t($error, $tokens));
      watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
    }

    return $result;
  }
public function createLdapEntry($attributes, $dn = NULL) {

    if (!$this->connection) {
      $this->connect();
      $this->bind();
    }
    if (isset($attributes['dn'])) {
      $dn = $attributes['dn'];
      unset($attributes['dn']);
    }
    elseif (!$dn) {
      return FALSE;
    }

    $result = @ldap_add($this->connection, $dn, $attributes);
    if (!$result) {
      $error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
      debug(t($error, $tokens));
      watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
    }

    return $result;
  }
public function createLdapEntry ( $ attributes , $ dn = NULL ) { if ( ! $ this -> connection ) { $ this -> connect ( ) ; $ this -> bind ( ) ; } if ( isset ( $ attributes [ 'dn' ] ) ) { $ dn = $ attributes [ 'dn' ] ; unset ( $ attributes [ 'dn' ] ) ; } elseif ( ! $ dn ) { return FALSE ; } $ result = @ ldap_add ( $ this -> connection , $ dn , $ attributes ) ; if ( ! $ result ) { $ error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str " ; $ tokens = array ( '%dn' => $ dn , '%sid' => $ this -> sid , '%ldap_errno' => ldap_errno ( $ this -> connection ) , '%ldap_err2str' => ldap_err2str ( ldap_errno ( $ this -> connection ) ) ) ; debug ( t ( $ error , $ tokens ) ) ; watchdog ( 'ldap_server' , $ error , $ tokens , WATCHDOG_ERROR ) ; } return $ result ; }
create ldap entry.

@param array $attributes should follow the structure of ldap_add functions
entry array: http://us.php.net/manual/en/function.ldap-add.php
$attributes["attribute1"] = "value";
$attributes["attribute2"][0] = "value1";
$attributes["attribute2"][1] = "value2";
@return boolean result
create ldap entry .