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: [EMAIL PROTECTED]
>
>
> 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
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to