Jump to content

ldap_bind with special characters


TheSambassador

Recommended Posts

Hello everyone!

 

I'm working on a PHP employee database that uses the local network's active directory to allow users to log in.

 

Basically, I'm using the ldap_bind command to authenticate and figure out what user is logging in.

 

The main snippet of code is:

 

$username = $_POST['username'];
$password = $_POST['password'];
$convertedPassword = utf8_encode($password);
if (ldap_bind($ds,"health1\\" . $username,$convertedPassword)){do stuff}

 

This works fine for normal username/passwords, but has been getting hung up on special characters.  I added the utf8_encode command, which allowed password with carrot (^) characters, but it still won't allow backslashes ( \ ).  I get

 

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in /var/www/emp/index.php on line 22

 

every time with a password such as "Blabla12\"

 

The utf8_encode command seems to be escaping the \, which I think is what I want.  Has anybody else had any luck with this?

 

-Sam

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.