Welcome Guest, Not a member yet? Register   Sign In
LDAP Windows Authentication
#1

Hi Guys i am beginner in Codeigniter

How to Create a login with LDAP Authentication? any help please..
Reply
#2

(08-01-2016, 06:59 AM)xyclode Wrote: Hi Guys i am beginner in Codeigniter

How to Create a login with LDAP Authentication? any help please..

The below is a basic way to do it (on a LAN)

PHP Code:
       $adServer 'domain.something.com'       //replace with your AD server ip/hostname
 
       $ldaprdn $username '@' $adServer //other format $ldaprdn = "DOMAIN\\" . $username;
 
       //Connecting to server
 
       $ldapconn ldap_connect($adServer)
 
               or die(); #connection resource -> always 1

 
       ldap_set_option($ldapconnLDAP_OPT_NETWORK_TIMEOUT5);
 
       ldap_set_option($ldapconnLDAP_OPT_TIMELIMIT30);

 
       //Connect to Server
 
       if ($ldapconn)
 
       {
 
           if ($ldapbind = @ldap_bind($ldapconn$ldaprdn$password))
 
           {
 
               //Succesfull Authentication
 
               return TRUE;
 
           } else
 
           {
 
               //Unsuccesfull Authentication
 
               return FALSE;
 
           }
 
       } else
 
       {
 
           // Could not connect to AD server.
 
           return FALSE;
 
       
Reply




Theme © iAndrew 2016 - Forum software by © MyBB