Skip to content

Instantly share code, notes, and snippets.

@blizzz
Created September 25, 2015 11:19
Show Gist options
  • Save blizzz/8bb7146ef69f0132a3d9 to your computer and use it in GitHub Desktop.
Save blizzz/8bb7146ef69f0132a3d9 to your computer and use it in GitHub Desktop.
PHP script that add's an email to an LDAP user
<?php
$dn = 'uid=zombie27755,ou=zombies,dc=owncloud,dc=bzoc';
$adn = 'uid=owncloudagent,ou=Users,dc=owncloud,dc=bzoc';
$apwd = '*******';
$mail = '[email protected]';
$host = 'ldap.owncloud.bzoc';
$port = 389;
$kv = array('mail' => $mail);
$cr = ldap_connect($host, $port);
ldap_set_option($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_bind($cr, $adn, $apwd);
ldap_mod_add($cr, $dn, $kv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment