Hello,
it's quite urgend, I need some help... I'm writing on a webinterface for
our LDAP-Server. I build an class which works with its advantages fine.
But i need to get the second entry from multivalued telephonenumber.
Below you see my code. Generally it works like this:
1) Instantiate an object: $user = new People("twi");
I put this object into a session. Whithin this session it's possible to
grap to all values of entries.
2) Getting values of entries :
print $user->getValues("givenname");
print $user->getValues("telephonenumber");
...
The first telephonenumber is allocated like this :
$this->telephonenumber = $info[0]["telephonenumber"][0];
print $user->getValues("telephonenumber"); -> ok
This doesn't work:
$this->telephonenumber1 = $info[0]["telephonenumber"][0];
print $user->getValues("telephonenumber1"); -> not
$this->telephonenumber2 = $info[0]["telephonenumber"][1];
print $user->getValues("telephonenumber1"); -> not
Can someone help me?
Thanks,
Tanja
### LDAP-Class:
include("LDAP.inc");
class People{
var $LDAP_HOST;
var $LDAP_BASE_DN;
var $c;
...
var $telephonenumber;
var $telephonenumber1;
var $telephonenumber2;
...
// Konstruktor
function People($uid){
$this->initEntries($uid);
}
function initEntries($uid){
global $LDAP_HOST, $LDAP_BASE_O, $LDAP_BASE_DN;
$attribut =
array("c","ou","o","uid","dn","cn","sn","givenname","displayname",
"initials","title","jpegphoto","telephonenumber",
"facsimiletelephonenumber","mobile","mail","homephone","l",
"postaladdress","homepostaladdress","labeleduri","roomnumber",
"userpassword","sheakadgrad","shedateofbirth","shehomemobile",
"shehomefax","shehomemail","shemitarbeiterstatus");
$ds=ldap_connect($LDAP_HOST);
if ($ds) {
$r=ldap_bind($ds);
$result=ldap_search($ds,$LDAP_BASE_O,"(uid=$uid)",$attribut);
$info = ldap_get_entries($ds, $result);
ldap_close($ds);
$this->c = $info[0]["c"][0];
...
$this->telephonenumber = $info[0]["telephonenumber"][0];
$this->telephonenumber1 = $info[0]["telephonenumber"][0];
$this->telephonenumber2 = $info[0]["telephonenumber"][1];
...
}else{
echo "Verbindung zu $host nicht �glich!!! -
getSpecEntries<p>\n";
}
} // ende initEntries()
function getValue($key){
return ($this->$key);
}
} // end Class People
--
Gruss Tanja
--------------------- DO IT RIGHT .SHE --------------------------
SHE Informationstechnologie AG
Tanja Winkelmann Fon:+49 621 5200-247
Studentin Fax:+49 621 5200-551
Donnersbergweg 3 [EMAIL PROTECTED]
D-67059 Ludwigshafen http://www.she.net
-----------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]