我有一个简单的html表单:
<html>
</head><style>
body {text-align:center;}
form{ margin: 0 auto; width: 500px;}
input{ padding: 10px; font-size:20;}
</style></head>
</body>
<h1>Login</h1>
<form action="idap.php" method="post">
<input type="text" name="username" /><br>
<input type="password" name="password" /><br>
<input type="submit" value="Login" />
</form>
</body>
</html>
提交后,我得到了这个脚本:
<?php
$ldap_dn= "uid=".$_POST["username"].",dc=XXXX,dc=XXXX";
$ldap_password= $_POST["password"];
$ldap_con =ldap_connect("prodldap.XXXX.com");
ldap_set_option($ldap_con, LDAP_OPT_PROTOCOL_VERSION,3);
if(ldap_bind($ldap_con, $ldap_dn,$ldap_password))
echo "Authenticated";
else
echo "Wrong login";
?>
通常我知道这些:
Server =“ prodldap.mycompany.com”;
ApplicationID =“ cn = dept-prod,ou = ApplicationUsers,o = myCompany”;
LDAPServerPassword =“密码”
问题 如何使用我的凭据登录并检查我是否存在于公司的LDAP服务器中?