Xác thực ldap: Cần có một server đã được thiết lập xác thực ldap - vd.
https://code.google.com/p/openssl-for-windows/downloads/list
serverxacthuldap.compnay.com
1. Chạy trên Xampp
1.1. cấu hình
mở file ở thư mục cài đặt xampp
tìm tới vd: C:\xampp\php\php.ini
;extension=php_ldap.dll
bỏ comment màu đỏ đi ->extension=php_ldap.dll
1.2. Code thực thi
<html>
<head></head>
<body>
<?php
// using ldap bind
$ldaprdn = 'username@company.com'; // ldap rdn or dn
$ldappass = '123456'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("ldap://serverxacthuldap.compnay.com") // Địa chỉ domain hoặc server dùng để xác thực
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
</body>
</html>
Không có nhận xét nào:
Đăng nhận xét