Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: text/plain");
- header("Content-Disposition: attachment; filename=seznam_mailboxu.csv");
- $ldap_server = 'ldap://pdcsrvdnc01.xxxx.cz';
- $auth_user = 'ldap';
- $auth_pass = 'xxxx';
- $base_dn = "OU=Uživatelé,DC=xxxx,DC=cz";
- $filter = "(&(objectClass=user)(kerio-Mail-AccountEnabled=1))";
- if (!($connect = ldap_connect ($ldap_server))) {
- die("Could not connect to ldap server");
- }
- if (!($bind = ldap_bind ($connect, $auth_user . '@xxxx.cz', $auth_pass))) {
- die('Unable to bind to server.');
- }
- if (!($search = ldap_search ($connect, $base_dn, $filter))) {
- die("Unable to search ldap server");
- }
- @@//$number_returned = ldap_count_entries ($connect, $search);
- $info = ldap_get_entries ($connect, $search);
- @@foreach($info as $oneInfo) {
- @@ $name = strtr(strtr($oneInfo['cn'][0], ' ', '-'), 'áäčďéěëíµňôóöŕřšťúůüýžÁÄČĎÉĚËÍĄŇÓÖÔŘŔŠŤÚŮÜÝŽ', 'aacdeeeilnooorrstuuuyzaacdeeelinooorrstuuuyz');
- $n = $oneInfo['cn'][0]. ';';
- for ($j=0; $j<count($oneInfo['member']); $j++) {
- $arr = explode(',', $oneInfo['member'][$j]);
- $n .= substr($arr[0], 3);
- }
- $n .= $oneInfo['l'][0]. ';';
- $n .= $oneInfo['samaccountname'][0]. '@xxxx.cz;';
- @@ $n .= "\r\n"
- }
- echo $n;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement