Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thanks for a great forum. My problem was answered just by scrolling through previously solved problems. Great service!!..."

Geography

Where in the world do Tek-Tips members come from?
Exode (Programmer)
2 Apr 04 11:15
Hi all,

I've run in a little problem this morning and wasn't able to find the answer so far, so I hope you guys can help me.

I'm trying to do a ldap_bind then test the value of the bind to make the authentication, but the the bind always return nothing (isn't it supposed to return true or false ?)
My dn and pass are ok, the connection works so I really don't know what I'm doing wrong. Here's my code:

$conLDAP = ldap_connect($ldap_var[db][host], $ldap_var[db][port])
$dn = $sArrayRechLdap[0][7];
$bindLDAP = @ldap_bind($conLDAP, $dn, $mdp);

if ($bindLDAP)
{
$sArrayLDAP = array(trim($sArrayRechLdap[0][0]),
trim($sArrayRechLdap[0][1]),
trim($sArrayRechLdap[0][2]),
trim($sArrayRechLdap[0][3]),
trim($sArrayRechLdap[0][4]),
trim($sArrayRechLdap[0][5]),
trim($sArrayRechLdap[0][6]));
$bGoodLogin = 1;
}

the $dn returns uid=atfrank,ou=Employee,ou=Person,dc=csaff,dc=qc,dc=ca
and the $mdp returns the correct password. However, the it never goes through the If because the $BindLDAP is always nothing.

Hope someone can help me out with this.Thanks for your time and help.
Frank
LTeeple (Programmer)
2 Apr 04 11:52
Hi there,
I'm not sure if you copy/pasted your code, but you're missing a semi-colon at the end of your first line:
$conLDAP = ldap_connect($ldap_var[db][host], $ldap_var[db][port]);

why don't you separate your code a bit, so you can isolate the point of failure?

Try:

CODE

if (!($conLDAP = ldap_connect($ldap_var[db][host],$ldap_var[db][port]))) {
  die ("Could not connect to LDAP server");
}

if (!($bindLDAP = @ldap_bind($ldap, $dn, $mdp))) {
      die ("Invalid username or password: Please try again");
}

I realize this may not solve your problem, but may assist in isolating where the problem occurs.


Cheers!
Laura

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close