Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher une fonction PHP

ldap_modify_batch

(PHP 5.4 >= 5.4.26, PHP 5.5 >= 5.5.10, PHP 5.6 >= 5.6.0, PHP 7)

ldap_modify_batchBatch and execute modifications on an LDAP entry

Description

ldap_modify_batch ( resource $link_identifier , string $dn , array $entry [, array $serverctrls = array() ] ) : bool

Modifies an existing entry in the LDAP directory. Allows detailed specification of the modifications to perform.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Parameters

link_identifier

An LDAP link identifier, returned by ldap_connect().

dn

The distinguished name of an LDAP entity.

entry

An array that specifies the modifications to make. Each entry in this array is an associative array with two or three keys: attrib maps to the name of the attribute to modify, modtype maps to the type of modification to perform, and (depending on the type of modification) values maps to an array of attribute values relevant to the modification.

Possible values for modtype include:

LDAP_MODIFY_BATCH_ADD

Each value specified through values is added (as an additional value) to the attribute named by attrib.

LDAP_MODIFY_BATCH_REMOVE

Each value specified through values is removed from the attribute named by attrib. Any value of the attribute not contained in the values array will remain untouched.

LDAP_MODIFY_BATCH_REMOVE_ALL

All values are removed from the attribute named by attrib. A values entry must not be provided.

LDAP_MODIFY_BATCH_REPLACE

All current values of the attribute named by attrib are replaced with the values specified through values.

Note that any value for attrib must be a string, any value for values must be an array of strings, and any value for modtype must be one of the LDAP_MODIFY_BATCH_* constants listed above.

serverctrls

Array of LDAP Controls to send with the request.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Return Values

Returns TRUE on success or FALSE on failure.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Changelog

Version Description
7.3 Support for serverctrls added

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Examples

Example #1 Add a telephone number to a contact

<?php
$dn 
"cn=John Smith,ou=Wizards,dc=example,dc=com";
$modifs = [
    [
        
"attrib"  => "telephoneNumber",
        
"modtype" => LDAP_MODIFY_BATCH_ADD,
        
"values"  => ["+1 555 555 1717"],
    ],
];
ldap_modify_batch($connection$dn$modifs);
?>

Example #2 Rename a user

<?php
$dn 
"cn=John Smith,ou=Wizards,dc=example,dc=com";
$modifs = [
    [
        
"attrib"  => "sn",
        
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
        
"values"  => ["Smith-Jones"],
    ],
    [
        
"attrib"  => "givenName",
        
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
        
"values"  => ["Jack"],
    ],
];
ldap_modify_batch($connection$dn$modifs);
ldap_rename($connection$dn"cn=Jack Smith-Jones"NULLTRUE);
?>

Example #3 Add two e-mail addresses to a user

<?php
$dn 
"cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
$modifs = [
    [
        
"attrib"  => "mail",
        
"modtype" => LDAP_MODIFY_BATCH_ADD,
        
"values"  => [
            
"jack.smith@example.com",
            
"jack.smith-jones@example.com",
        ],
    ],
];
ldap_modify_batch($connection$dn$modifs);
?>

Example #4 Change a user's password

<?php
$dn 
"cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
$modifs = [
    [
        
"attrib"  => "userPassword",
        
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
        
"values"  => ["Tr0ub4dor&3"],
    ],
    [
        
"attrib"  => "userPassword",
        
"modtype" => LDAP_MODIFY_BATCH_ADD,
        
"values"  => ["correct horse battery staple"],
    ],
];
ldap_modify_batch($connection$dn$modifs);
?>

Example #5 Change a user's password (Active Directory)

<?php
function adifyPw($pw)
{
    return 
iconv("UTF-8""UTF-16LE"'"' $pw '"');
}

$dn "cn=Jack Smith-Jones,ou=Wizards,dc=ad,dc=example,dc=com";
$modifs = [
    [
        
"attrib"  => "unicodePwd",
        
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
        
"values"  => [adifyPw("Tr0ub4dor&3")],
    ],
    [
        
"attrib"  => "unicodePwd",
        
"modtype" => LDAP_MODIFY_BATCH_ADD,
        
"values"  => [adifyPw("correct horse battery staple")],
    ],
];
ldap_modify_batch($connection$dn$modifs);

Zoek een PHP-functie

Vertaling niet beschikbaar

De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.

Als je de moed voelt, kun je je vertaling aanbieden ;-)

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-function.ldap-modify-batch.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : http://php.net

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut