You are here: Re: PHP and Active Directory « PHP Programming Language « IT news, forums, messages
Re: PHP and Active Directory

Posted by NC on 11/28/05 04:08

andyt_2000_uk@yahoo.co.uk wrote:
>
> I'm trying to get it so visitors to our intranet site are able to log
> into the site with there normal login details. On a network using
> win2k3, active directory etc.
>
> Now my code at the moment seems to connect to AD but it fails
> when it trys to bind.

Of course it does... Consider a few changes to your code:

//Connect to Active Directory
$ad = ldap_connect('hole.chase.local', 389)
// First change ^^^^^^^^^^^^^^^^^^^^^^^
or die("Couldn't connect to AD!"."<br />");
echo "connect result is " . $ad . "<br />";
//set protocol version
if (ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3)) {
// Second change ^^
echo "Using LDAPv3". "<br />";
} else {
echo "Failed to set protocol version to 3";
}
$ldaprdn = 'andy';
$ldappass = 'password';
//Bind to Active Directory
if ($ad) {
$bd = ldap_bind($ad, $ldaprdn, $ldappass)
or die("Couldn't bind to AD!");
}
if ($bd) {
echo "success"."<br />";
} else {
echo "fail"."<br />";
}

Cheers,
NC

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация