RE: [PHP] ldap_modify parameters?

From: Date: Thu, 01 Aug 2002 13:52:12 +0000
Subject: RE: [PHP] ldap_modify parameters?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110669@lists.php.net to get a copy of this message
Also tried that, no success, unless I am missing something. ... $info["st"]="stchanged!"; ... ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info); Fatal error: LDAP: Unknown Attribute in the data in /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31 Chad -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@php.net] Sent: Thursday, August 01, 2002 9:41 AM To: Chad Day Cc: php-general@lists.php.net Subject: Re: [PHP] ldap_modify parameters? I think your problem is that you are passing the output of ldap_get_entries() directly back into ldap_modify(). ldap_get_entries() returns an array of result elements whereas ldap_modify() is expecting a single element. So, to change the 'st' attribute for the uid=testing record, you should simply do: $data['st'] = 'stchanged'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data); If st takes multiple values, use: $data['st'][0] = 'stchanged'; $data['st'][1] = '2nd value'; ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data); -Rasmus On Thu, 1 Aug 2002, Chad Day wrote: > I think something is wrong with the way I am calling ldap_modify, but I'm > not sure exactly what, from the scripts and tutorials I've been looking > at/experimenting with: > > $ds=ldap_connect("online-leagues.com"); > if ($ds) { > $r=ldap_bind($ds, 'username', 'password'); > // Search surname entry > $sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing'); > echo "Search result is ".$sr."<p>"; > $info = ldap_get_entries($ds, $sr); > echo "dn is: ". $info[0]["dn"] ."<br>"; > echo "first cn entry is: ". $info[0]["cn"][0] > ."<br>"; > echo "first email entry is: ". $info[0]["mail"][0] > ."<p>"; > echo "st = ". $info[0]["st"][0] ."<p>"; > > $info[0]["st"][0]="stchanged!"; > > ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info); > echo "Closing connection"; > ldap_close($ds); > > } else { > echo "<h4>Unable to connect to LDAP server</h4>"; > } > > The error returned is: > > Fatal error: LDAP: Unknown Attribute in the data in > /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31 > > I looked up the error on google but didn't find anything.. > > > Running ldapsearch from the command line on my box, the record looks like: > > > # > # filter: (objectclass=*) > # requesting: ALL > # > > # online-leagues.com > dn: cn=online-leagues.com > objectclass: top > objectclass: organization > objectclass: CommuniGateDomain > cn: online-leagues.com > o: www.online-leagues.com > > > # testing, online-leagues.com > dn: uid=testing,cn=online-leagues.com > objectclass: top > objectclass: person > objectclass: organizationalPerson > objectclass: inetOrgPerson > objectclass: CommuniGateAccount > cn: rn > hostServer: online-leagues.com > sn: > st: st > street: str > telephoneNumber: tn > uid: testing > mail: testing@online-leagues.com > > > so I think the dn is right, but I'm not 100% sure now. Any ideas? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#110669) next »