diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php new file mode 100644 index 00000000000..a8187a7c0c4 --- /dev/null +++ b/htdocs/admin/ldap.php @@ -0,0 +1,146 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ +require("./pre.inc.php"); + +if ($_GET["action"] == 'setvalue' && $user->admin) +{ + $sql = "REPLACE INTO llx_const SET name = 'LDAP_SERVER_HOST', value='".$HTTP_POST_VARS["host"]."', visible=0"; + + $db->query($sql); + + $sql = "REPLACE INTO llx_const SET name = 'LDAP_SERVER_DN', value='".$HTTP_POST_VARS["dn"]."', visible=0"; + + $db->query($sql); + + $sql = "REPLACE INTO llx_const SET name = 'LDAP_SERVER_LOGIN', value='".$HTTP_POST_VARS["login"]."', visible=0"; + + $db->query($sql); + + $sql = "REPLACE INTO llx_const SET name = 'LDAP_SERVER_PASS', value='".$HTTP_POST_VARS["pass"]."', visible=0"; + + $db->query($sql); + + + if ($db->query($sql)) + { + Header("Location: ldap.php"); + } +} + +llxHeader(); + +if (!$user->admin) +{ + print "Forbidden"; + llxfooter(); + exit; +} +/* + * + */ +print_titre("Configuration de ldap"); +/* + * + */ +print ''; +print ''; +print '
'; + +print ''; +print ''; +print ''; +print ''; +print "\n"; +print ''; + +print ''; +print ''; +print ''; + +print '
NomValeur 
Serveur LDAP'.LDAP_SERVER_HOST.'
DN'.LDAP_SERVER_DN.'
DN'.LDAP_SERVER_LOGIN.'
DN'.LDAP_SERVER_PASS.'
'; + +print '
'; + +print '
'; + +print ''; +print ''; +print ''; +print ''; +print "\n"; +print ''; +print ''; +print ''; +print ''; + +print ''; +print '
NomValeur 
'; +print 'Serveur LDAP'; +print ''; +print '
DN'; +print ''; +print '
Login'; +print ''; +print '
Pass'; +print ''; +print '
'; + +print '
'; + + +if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && $test) +{ + $ds = ldap_connect(LDAP_SERVER_HOST); + + if ($ds) + { + $connect = "ok"; + + //ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + if ($pass) + { + $ldapbind=ldap_bind($ds, $dn, $pass); + } + else + { + $ldapbind=ldap_bind($ds, $dn); + if ($ldapbind) + { + $bind = "ok"; + } + else + { + $bind = "erreur"; + } + } + } + else + { + $connect = "erreur"; + } +} + + + +$db->close(); + +llxFooter(); +?>