Beyaz.Net İpucu

KATEGORİLER

Genel
FreeBSD
Debian
Ubuntu

LDAP Bağlantısı PHP

$hataNo = '1';
function ldap_authenticate($username, $password) {
   
        $ds = '';  $r = ''; $result = '';
        $ds=@ldap_connect("localhost");
        if($ds) {
       
            $r = @ldap_search( $ds, "ou=People", 'uid=' . $username);
            if ($r) {
                $result = @ldap_get_entries( $ds, $r);
                if ($result) {
                    if (@ldap_bind( $ds, $result[0]['dn'], $password) ) {
                        $_SESSION['giris']    = TRUE;
                        $_SESSION['uname']  = $username;
                        $_SESSION['pass']   = $password;
                        return $hataNo = '0';
                    }
                }
            }
           
        }
 
        return $hataNo = '1';
    }   


if(ldap_authenticate("beyaz", "net")=='0')
    echo "LDAP giriş yapıldı";
else
   echo "LDAP giriş hatalı";

Kategorideki Güncel Makaleler