April 29th, 2012, 12:33 AM
Simple LDAP Authentication using PHP
I am a newbie to LDAP...I completely do not know how it works,how is it configured,and even how it is run . I just need this particular functionality to be implemented within the next few days..I have implemented a user login authentication in PHP using MySQL---in a file login.php. I need to implement the same authentication process using LDAP in the same file.So i am basically doing
I have downloaded this particular software OpenLDAP for Windows- from userbooster.de
But I do not know how to even use it...tried to find a lot of info,but nothin was clear.i just understood a few examples from php.net
So here is what I need to do exactly,
1.I have a MySQl Database -sqlia and Table -user with fields "uname" and "pass".I have around 25 entries.
2. I need to know how to store this MySQL data in an LDAP directory and how to retrieve necessary data from LDAP .
3. Finally,I need to run a query based on whether an entered username and password matches in the LDAP directory,thereby authenticating the user.
This whole process should be done in PHP.
Importantly,this whole process should be done in Windows 7,not in any Linux based environment.
I understand this process might take around 20 - 30 LOC , but someone please help me out..This s really important,Have been breaking my head for the last 2 weeks and not able to get anywhere.
Waiting for a response !
Typically you would authentic the user by querying LDAP. Is there a particular reason you want to use two forms of authentication? Also, is this Active Directory based LDAP?
Last edited by gmrstudios; May 4th, 2012 at 03:04 PM.
I am doing a project.So its just a proposed concept to have two levels of Authentication..to make the database a bit more secure..And i do not know what Active LDAP directory what you are talking about... I just saw a lot of Active directories- OpenLDAP for Windows,ApacheDS..problem is i do not even know even to configure them..downloaded Open lDAP for windows from userbooster.de
Originally Posted by gmrstudios
Can u help me out..need this to be done by tomoro.Metion ur mail id ,i will send u my files.
This is my login code.I need to fit in the LDAP authentication just anywhere inside after SQL query statement.
Help me out.
if($uname && $pass)
$query="select uname from user where uname='$uname' and pass='$pass'";
// echo "<input type='hidden' value=";
// echo "$row";
// echo " name='a'>";
//echo "Login Success";
<div style="position:absolute;left:15px;top:200px;width:400px;height:20px;z-index:0;"> Incorrect Username and Passsword</div>
<div style="position:absolute;left:15px;top:200px;width:200px;height:20px;z-index:0;"> Enter User Name and Password</div>