Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ldap_add server is unwilling to perform

Status
Not open for further replies.

cartoonjunkie

Programmer
Jul 15, 2010
1
CA
Hello
I am trying to create a php web site that I can use to create a new user in Active Directory
So far I can view accounts using this web site but I can't use the ldap_add
I use domain admin credentials but it still is not working
I am using wampserver 2.0

Any help you can give me would be great!

The code I have added does bind successfully and I can do an ldap search.


I have just changed the some of the info for security reasons

Code:
<?php
$ldaprdn = "dadmin@mycompany.ca";
$ldappass = "password";
		
$ldapconn = ldap_connect("10.1.9.1",3268)
    or die("Could not connect to LDAP server.");

if (ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3) == false) 
	echo "Failed to set protocol version to 3";
	

$usernameAndBaseDN ="cn =admin, domain, ou=Users,ou=Information Technology,Ou=our company,DC=company,DC=ca";
	
	
	
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);



//if (ldap_start_tls($ldapconn))
 //   echo "started";

// verify binding
if ($ldapbind == false)
	echo "LDAP bind failed...";


$info["cn"] = "Slim Shady";
$info["sn"] = "Shady";
$info["mail"] = "sshady@example.com";
$info["objectclass"] = "person";

$r = ldap_add($ldapconn, "ou=users,ou=City,ou=our company,DC=company,DC=CA", $info);

?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top