function LDAP_Authenticate(lcDN,lcpassword,lcServer,liPort) Declare long ldap_init In Wldap32 String Hostname,long portnumber Declare long ldap_bind_s In wldap32 Long iHandle,String cDN,string cCredential, long iMethod DECLARE ldap_set_option IN wldap32 long iHandle,integer option,integer ivalue Declare ldap_unbind In wldap32 Long iHandle #Define LDAP_PORT 389 #Define LDAP_SSL_PORT 636 #Define LDAP_AUTH_SIMPLE 0x80 #DEFINE LDAP_OPT_VERSION 0x11 #Define LDAP_SUCCESS 0x00 local liSessionHandle,liTemp,liAuth *--- sample credentials for free online LDAP lcDN="uid=einstein,dc=example,dc=com" lcPassword="password" lcServer="ldap.forumsys.com" liPort=389 liSessionHandle=LDAP_INIT(m.lcServer,m.liPort) &&LDAP session handle If m.liSessionHandle=0 Error "Unable to connect to "+m.lcServer+": "+getwindowserror() &&getwindowserror function pulls latest Windows error ELSE ldap_set_option(m.lisessionHandle,LDAP_OPT_VERSION,3) &&version 3; optional liAuth=-1 liAuth=LDAP_BIND_S(m.liSessionHandle,lcDN,lcPassword,LDAP_AUTH_SIMPLE ) ldap_unbind(m.liSessionHandle) If m.liAuth=LDAP_SUCCESS &&user is authenticated Else Error "Server returned Error Code "+Transform(m.liAuth) Endif Endif