<?php

$q = $_GET["q"];
if (!q) {
    return;
}
require "../core/ldap.php";
$ldap = new Ldap();
$userinfos = $ldap->find(array("cn" => "*{$q}*"), array("cn", "uid"));
foreach ($userinfos as $userinfo) {
    echo $userinfo['cn'] . "|" . $userinfo['uid'] . "\n";
}
Exemple #2
0
 function getUserInfoFromLdap($fields = array("sn", "cn", "givenname", "uisid"))
 {
     $ldap = new Ldap();
     $userdata = $ldap->find(array("uid" => $this->username), $fields);
     // ak zadany user nie je korektny v ramci LDAPu
     if (empty($userdata)) {
         return false;
     }
     $this->fullname = addslashes($userdata[0]["cn"]);
     $this->meno = addslashes($userdata[0]["givenname"]);
     $this->priezvisko = addslashes($userdata[0]["sn"]);
     $this->ais_id = addslashes($userdata[0]["uisid"]);
     // tituly stuff
     if (preg_match("/^(.*) {$this->meno}/", $this->fullname, $matches)) {
         $this->tituly_pred = $matches[1];
     } else {
         $this->tituly_pred = "";
     }
     if (preg_match("/{$this->priezvisko}, (.*)\$/", $this->fullname, $matches)) {
         $this->tituly_za = $matches[1];
     } else {
         $this->tituly_za = "";
     }
     return true;
 }