Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Active directory and PHP

 
   Database Help (Home) -> PHP RSS
Next:  Text formatting  
Author Message
mlimacarlos

External


Since: Jan 28, 2008
Posts: 2



(Msg. 1) Posted: Mon Jan 28, 2008 10:01 am
Post subject: Active directory and PHP
Archived from groups: alt>comp>lang>php (more info?)

Is there anyway to work PHP with Active directory? My intention
consist in developing an application that authenticates automatically
PHP on W2k3 server.
tks,
Marcos

 >> Stay informed about: Active directory and PHP 
Back to top
Login to vote
ZeldorBlat

External


Since: Dec 10, 2007
Posts: 107



(Msg. 2) Posted: Mon Jan 28, 2008 11:08 am
Post subject: Re: Active directory and PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 1:01 pm, "mlimacar...@gmail.com" <mlimacar... RemoveThis @gmail.com>
wrote:
> Is there anyway to work PHP with Active directory? My intention
> consist in developing an application that authenticates automatically
> PHP on W2k3 server.
> tks,
> Marcos

Here's how I usually do it. Requires the PHP LDAP extension:

$domain_controller = 'mydc';
$domain = 'foo.local';

if(empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW']))
{
header('WWW-Authenticate: Basic realm="' . $domain . '"');
header('HTTP/1.0 401 Unauthorized');
die(); //if they hit cancel
}

if(($ldap = @ldap_connect($domain_controller, 389)) !== false) {
if(@ldap_bind($ldap, $_SERVER['PHP_AUTH_USER'] . '@' . $domain,
$_SERVER['PHP_AUTH_PW']) !== false) {
//Their credentials were valid, so do whatever you need to do
}
else {
//Their credentials weren't valid
header('WWW-Authenticate: Basic realm="' . $domain . '"');
header('HTTP/1.0 401 Unauthorized');
die(); //if they hit cancel
}
}

 >> Stay informed about: Active directory and PHP 
Back to top
Login to vote
Ivan Marsh

External


Since: Jan 14, 2008
Posts: 81



(Msg. 3) Posted: Mon Jan 28, 2008 12:21 pm
Post subject: Re: Active directory and PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 28 Jan 2008 10:01:22 -0800, mlimacarlos.TakeThisOut@gmail.com wrote:

> Is there anyway to work PHP with Active directory? My intention consist
> in developing an application that authenticates automatically PHP on
> W2k3 server.
> tks,
> Marcos

Certainly.

You can use LDAP directly from PHP or you can set up the webserver itself
to authenticate to AD through LDAP.

Not sure if you're talking about 2000 or 2003... afaik 2003 Active
Directory uses kerberos so that may be a more difficult cat to skin.

--
I told you this was going to happen.
 >> Stay informed about: Active directory and PHP 
Back to top
Login to vote
mlimacarlos

External


Since: Jan 28, 2008
Posts: 2



(Msg. 4) Posted: Mon Jan 28, 2008 12:40 pm
Post subject: Re: Active directory and PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tks,
It was this that I needed.

On Jan 28, 5:08 pm, ZeldorBlat <zeldorb... RemoveThis @gmail.com> wrote:
> On Jan 28, 1:01 pm, "mlimacar...@gmail.com" <mlimacar... RemoveThis @gmail.com>
> wrote:
>
> > Is there anyway to work PHP with Active directory? My intention
> > consist in developing an application that authenticates automatically
> > PHP on W2k3 server.
> > tks,
> > Marcos
>
 >> Stay informed about: Active directory and PHP 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
creating active directory user - does anyone already tried to create a user into active directory through php_ldap ? i tried something like this but still don't work :-/ $adduserAD["cn"][0] = "phpldapuser"; $adduserAD["samaccountname"][0] = "gug...

authentification on Active Directory with LDAP - Hello, my english is not so good. I want to use the users of our active directory in the intranet for a portal page. i dont know how to authenticate? $server = "xxx-xx.de.xx.com"; $connectid = @ldap_connect($server); is ok. $binding =..

Active directory authentication via php. - Greetings. I'm in a bit of a pickle.. at the company where I recently started work, I discovered that the knowledge base we use sucks, and sucks bad (oh Lotus Notes, how I loathe thee, let me count the ways) So for kicks and giggles, I found a nice..

Authenticating users from Windows Active Directory from PH.. - I want to authenticate users (defined in an Active Directory Service running on a Windows 2000 Server machine) from PHP Code running under Linux (Fedora Core 3 with Kerberos 5 installed). I just want to find out whether a particular user (with a given..

unable to connect to active directory server - I'm trying to connect to an Active Directory server and am having some difficulties. Here's the code I'm using: <?php if (!($ldap = ldap_connect('domain.tld')) { exit('unable to connect'); } ldap_bind($ldap, 'username', 'password'); ?> With th...
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]