Invalid Credentials

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a simple php script that binds to an openldap server but I keep getting this error message;

Warning: ldap_bind(): Unable to bind to server: Invalid credentials in /srv/www/site.com/check-user2.php on line 15
LDAP bind failed...

The password is correct so I'm not quite sure why getting this error. Is there something wrong with my code?

Here's the PHP script:

##############################################################
<?php

$ldapdn=$_POST['users'];
$basedn=$_POST['dn'];
$ldappass=$_POST['pw'];
ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);


$ldapconn = ldap_connect("192.168.15.130")
   or die("Could not connect to LDAP server.");

if ($ldapconn) {

   // binding to ldap server
   $ldapbind = ldap_bind($ldapconn, "$ldapdn" . "$basedn", $ldappass);

   // verify binding
   if ($ldapbind) {
       echo "LDAP bind successful...";
   } else {
       echo "LDAP bind failed...";
   }

}

?>
################################################################


Here's the HTML form:

################################################################
<html>
<head>
<title>LDAP Authentication</title>
</head>

<body>

<form name="Login" method="post" action="check-user2.php">
 <table>
   <tr>
     <td>User Name</td>
     <td>

     <select name="users">
<option value="uid=bobby">Bobby</option>
<option value="uid=felicia">Felicia</option>
</select>
<INPUT TYPE="hidden" NAME="dn" value="ou=people,dc=site,dc=com"></td>
   </tr>
   <tr>
     <td>Password</td>
     <td><input type="password" name="pw">
     </td>
   </tr>
 </table>
 <input type=image src="images/login.gif" alt="Login"
name="image">
</form>

</body>
</html>
#################################################################

- Delamatrix

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux