Jump to content

TheSambassador

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by TheSambassador

  1. 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

     

     

×
×
  • 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.