[PHP] Invalid Credentials

2006-02-20 Thread Delamatrix

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
titleLDAP Authentication/title
/head

body

form name=Login method=post action=check-user2.php
 table
   tr
 tdUser Name/td
 td

 select name=users
option value=uid=bobbyBobby/option
option value=uid=feliciaFelicia/option
/select
INPUT TYPE=hidden NAME=dn value=ou=people,dc=site,dc=com/td
   /tr
   tr
 tdPassword/td
 tdinput 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



Re: [PHP] PHP/LDAP Authentication

2006-02-19 Thread Delamatrix

Thanks for all the help!  I'll check it out.

- Delamatrix


Weber Sites LTD wrote:

Maybe this can help :

Authentication script to authenticate users in Active Directory through
LDAP.
http://www.weberdev.com/get_example-3261.html
 
Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
Search for PHP Code from your browser http://toolbar.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com

SEO Data Monitor http://seo.weberdev.com


-Original Message-
From: Golden Butler [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 19, 2006 8:40 AM

To: PHP Mailing List
Subject: [PHP] PHP/LDAP Authentication



I'm currently running OpenLDAP with some users populated in the database.  I
would like to use PHP to create a web page where my ldap users can enter
their username and password credentials to log into our intranet.  Can
someone point me to some expample scripts, articles, or sites.  Thanks.

- Delamatrix 


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