Hi All!
So I need to manage some accounts in AD on MS Sever 2003, but I dont want to use ASP.net
Is there any way to manage AD accounts through the PHP?
Hi All!
So I need to manage some accounts in AD on MS Sever 2003, but I dont want to use ASP.net
Is there any way to manage AD accounts through the PHP?
Hi,
I think that's possible with the ldap functions. What exactly do you want to do ?
Thomas
well the LDAP is only way to controll ad remotely as far as I know...
basically I dont know what exactly will I need, but it should be something like creating and managing user account settings.
As to my finall project, I need to create some sort of software thar will work as Hot-Spot for wi-fi users, so if they in the zone they should be able to get on reg age andd add their user account to the server.
oh yes another thing:
the control should work through the interne w/ ip address :-(
Yeah you need AD installed with LDAP server running.
Then compile PHP with LDAP installed and your set. Now once you do that do this: What this will do is run a query against AD to find all the names that have Smith, Chad* listed. That should return only one if you have a Smith, Chad in the displayName field.
function GetADName ($first, $last)
{
//set variables to be used throughout function
$domain = "myserver.domain.com";
$domain_username = "username" . '@' . $domain;
$password = "password";
//variables to be used in LDAP queries for searching
//The DN will need to be changed accordingly once the Active Directory hierarchy is completed.
$dn = "CN=Users,DC=sweet,DC=notice,DC=no,DC=dots";
// CAPS do not matter with this filter.
$filter = "(&(objectclass=user)(displayName=Smith, Chad*))";
//Connects to our LDAP server.
$ldap_conn = ldap_connect("ldap://$domain") or
die("The connection to the ldap server $domain failed.");
ldap_set_option( $ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3 ) or
die ("Could not set LDAP Protocol version");
//bind to ldap server
$bind = ldap_bind($ldap_conn, $domain_username, $password) or
die ("could not bind to AD authorized probably failed.");
//search AD for the information based on $filter and $attributes
$attributes = array ("displayName" , "telephoneNumber" , "physicalDeliveryOfficeName");
$search_result = ldap_search( $ldap_conn, $dn, $filter, $attributes ) or
die ("LDAP search has failed");
$num_entries = ldap_count_entries($ldap_conn, $search_result);
if($num_entries == 1)
{
//get the entries that were returned in the search
$info = ldap_get_entries( $ldap_conn, $search_result ) or
die ("Failed on ldap_get_entries");
for ($i=0; $i<$info["count"]; $i++) {
$name = $info[$i][displayname][0];
$office = $info[$i][physicaldeliveryofficename][0];
$tele = $info[$i][telephonenumber][0];
$build_return = "$name;"."$office;"."$tele";
return $build_return;
}
}else{
return 0;
}
//unbind connection
ldap_unbind($ldap_conn);
}
?>
thais is the same as in docvumentation, well almost...
How do I compile the file for php... and how can I use IP address instead of DNS name?