password != $_SESSION['confwiz_masterpwd']) {
require("../config/conflogin.php");
exit;
}
// check if user clicked on buttons
if ($_POST['submit'] || $_POST['cancel']) {
unset($error);
unset($ret);
if ($_POST['cancel']) {
@unlink("../../config/" . $_SESSION['confwiz_config']->file . ".conf");
metarefresh('../config/conflogin.php');
}
else {
// check server URL
if ($_SESSION['confwiz_config']->set_serverURL($_POST['serverurl'])) {
// set Samba version
if ($_POST['sambaversion'] == "2") $_SESSION['confwiz_config']->set_samba3("no");
else $_SESSION['confwiz_config']->set_samba3("yes");
$_SESSION['confwiz_config']->set_Adminstring($_POST['ldapadmin']);
// save settings
$_SESSION['confwiz_config']->save();
// create LDAP object and test connection
$_SESSION['confwiz_ldap'] = new Ldap($_SESSION['confwiz_config']);
$ret = $_SESSION['confwiz_ldap']->connect($_POST['ldapadmin'], $_POST['ldappwd']);
if ($ret === 0) {
metarefresh('server2.php');
}
elseif ($ret === False) $error = _("Cannot connect to specified LDAP-Server. Please try again.");
elseif ($ret == 81) $error = _("Cannot connect to specified LDAP-Server. Please try again.");
elseif ($ret == 49) $error = _("Wrong Password/Username combination. Try again.");
else $error = _("LDAP error, server says:") . "\n
($ret) " . ldap_err2str($ret);
}
else {
$error = _("Server Address is empty!");
}
// print error message if needed
if ($error) {
echo $_SESSION['header'];
echo "\n";
echo "