|
|
|
|
|
|
| |
| <?
//Looking User Information into the Windows 2003 Active Directory
//Configurarion Section
$ldap_server="some.ip.addrr"; //The Active Directory Server
$ad_domainNB="someNBdomain"; //The Netbios name of the domain
$ad_domain="domain.com";
$ad_user="user1"; //Active Directory Valid User
$ad_userPass="pass"; //Active Directory Valid User Password
$user="user2"; //Active Directory Valid User looking for
$domain_parts = explode(".",$ad_domain); //Extract every part of the domain
$ad_base_search="";
for ($x=0;$x<sizeof($domain_parts);$x++) //Upper Case Parts and Build a base search string
{
$domain_parts[$x] = strtoupper($domain_parts[$x]);
if ($x==sizeof($domain_parts)-1)
{
$ad_base_search .= "dc=" . $domain_parts[$x];
}
else
{
$ad_base_search .= "dc=" . $domain_parts[$x] . ",";
}
}
$ds=ldap_connect($ldap_server);//Conecting to the Server
if ($ds) //if Conection is ok we continue
{
//Setting the Ldap Query options
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
//Setting the Ldap Query options
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
//Validation with the Active Directory
@$r=ldap_bind($ds, $ad_domainNB . '\\' . $ad_user,$ad_userPass);
//Querying the Active Directory
@$sr=ldap_search($ds,$ad_base_search, "cn=" . $user);
//Fetching the result
@$info = ldap_get_entries($ds, $sr);
//Extracting the data
list($cn,$ou,$dc) = split(",",$info[0]["dn"]);
//Extracting the data
list($basura,$depto) = split("=",$ou);
//Formating Data Some Latin chars may not propertly shown
$nombre = utf8_decode($info[0]["displayname"][0]);
//Formating Data Some Latin chars may not propertly shown
$departamento = utf8_decode($depto);
}
// Closing LDAP Conection
@ldap_close($ds);
echo $nombre ."<br>";
echo $departamento . "<br>";
?> | | |
|
| Authentication script to authenticate users in Active Directory through LDAP. Categories : LDAP, Authentication, Cookies, PHP | | | ldap_add -- Add entries to LDAP directory Categories : PHP, PHP Functions, LDAP | | | A web-based php3 IMAP email client supporting address books, attachements (downloading and sending), LDAP searching, and much much more. Categories : Email, PHP, LDAP | | | Introduction to LDAP Categories : LDAP, PHP | | | Authenticator for Exchange Server LDAP Categories : PHP, Authentication, LDAP, Security, Sessions | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | How to query a directory server using LDAP.
Keywords: ldap_connect ldap_search Categories : LDAP, Network, PHP | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Authorize.net AIM Interface Class v1.0.0 Categories : PHP, PHP Classes, Ecommerce, Payment Gateways | | | Function to remember password Categories : PHP, Authentication, Personalization and Membership | | | Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality. Categories : PHP, GD image library, Graphics | |
|
|
|