Ajoute protocole de test

This commit is contained in:
Rodolphe Quiedeville 2004-01-23 13:31:09 +00:00
parent dc7a8634c2
commit ea4771ca15

View File

@ -19,6 +19,7 @@
* $Source$ * $Source$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require (DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
if ($_GET["action"] == 'setvalue' && $user->admin) if ($_GET["action"] == 'setvalue' && $user->admin)
{ {
@ -105,41 +106,35 @@ print '</table></form>';
print '</td></tr></table>'; print '</td></tr></table>';
print '<a href="ldap.php?action=test">test</a><br>';
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && $test) if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && $_GET["action"] == 'test')
{ {
$ds = ldap_connect(LDAP_SERVER_HOST); $ds = dolibarr_ldap_connect();
if ($ds) if ($ds)
{ {
$connect = "ok"; print "connect ok<br>";
//ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); //ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($pass)
$ldapbind = dolibarr_ldap_bind($ds);
if ($ldapbind)
{ {
$ldapbind=ldap_bind($ds, $dn, $pass); print "bind ok<br>";
} }
else else
{ {
$ldapbind=ldap_bind($ds, $dn); print "bind erreur<br>";
if ($ldapbind)
{
$bind = "ok";
}
else
{
$bind = "erreur";
}
} }
ldap_close($ds);
} }
else else
{ {
$connect = "erreur"; print "connect erreur<br>";
} }
} }
$db->close(); $db->close();
llxFooter(); llxFooter();