LDAP Authentication in PHP made simple

<?php
require_once('Auth.php');

// Authenticating with Active Directory
$auth = new Auth("LDAP", array(
   'host' => 'ldap://hostname.domain.com',
   'version' => 3,
   'binddn' => 'CN=Morpheus,DC=domain',
   'bindpw' => 'fishburne',
   'basedn' => 'OU=Users,DC=domain',
   'userattr' => 'samaccountname',
   'userfilter' => '(objectClass=person)',
   'start_tls' => 'true'
   ));

$auth->start();

if ($auth->getAuth()) {
	// validated users
	print "Welcome to the desert of the real";
} else {
	// not yet authenticated
	print "Don't think you are, know you are.";
}

$auth->logout();
?>
Posted by admica   @   2 July 2009

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« cpp fails sanity check solved for pecl installations!
Next Post
Secure Delete shell script - Simple but complete »
Powered by Wordpress   |   Lunated designed by ZenVerse