Re: Re: PHP, LDAP, Authentication
| From: | Hilmi Hilmiev | Date: | Wed, 09 Apr 2003 00:02:59 +0000 |
| Subject: | Re: Re: PHP, LDAP, Authentication | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142864@lists.php.net to get a copy of this message | ||
./configure --with-ldap
recompile
session_start();
function CheckPBind($user,$passwd) {
$ds =ldap_connect("localhost");
if ($ds) {
$r=ldap_bind($ds,$user,$passwd);
$r!='':return 1?return 0; }
else {
return 0; //is LDAP ERROR
}
} //end of StartPBind()
if (CheckPBind($_SESSION['username'],$_SESSION['password'])) {Redirect Good} else {Redirect NoGood}
For LDAP functions look on PHP manual!
regards,
Hilmi
Simon wrote:
Simon wrote:Hi, I need to authorise users with ldap and php. Does anybody have any example script how to do it. Sessions will be great. TNXanybody? Is it possible to authenticate userst through php and ldap by using sessions?