get_defaultLanguage(); // loading available languages from language.conf file $languagefile = "../config/language"; if(is_file($languagefile) == True) { $file = fopen($languagefile, "r"); $i = 0; while(!feof($file)) { $line = fgets($file, 1024); if($line == "" || $line == "\n" || $line[0] == "#") continue; // ignore comment and empty lines $value = explode(":", $line); $languages[$i]["link"] = $value[0] . ":" . $value[1]; $languages[$i]["descr"] = $value[2]; if(rtrim($line) == $_SESSION["language"]) { $languages[$i]["default"] = "YES"; } else { $languages[$i]["default"] = "NO"; } $i++; } fclose($file); } else { $message = _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site."); } $profiles = getConfigProfiles(); setlanguage(); // setting correct language echo " "; echo "LDAP Account Manager -Login-"; echo "

"; echo _("Configuration Login"); echo "





"; echo _("Enter Username and Password for Account:"); echo "

"; if($error_message != "") { echo "

"; echo $error_message; echo "

"; } echo "
"; if($message != "") { echo " "; } else { echo " "; } echo "
"; echo _("Username:"); echo "
"; echo _("Password:"); echo "
"; echo $message; echo " "; echo _("Your Language:"); echo "
"; echo "



"; echo _("You are connecting to ServerURL: "); echo " "; echo $config_object->get_ServerURL(); echo "
"; } // checking if the submitted username/password is correct. if($_POST['action'] == "checklogin") { include_once("../lib/ldap.inc"); // Include ldap.php which provides Ldap class $ldap = new Ldap($_SESSION['config']); //$config); // Create new Ldap object if($_POST['passwd'] == "") { $error_message = _("Empty Password submitted. Try again."); display_LoginPage($_SESSION['config']); // Empty password submitted. Return to login page. } else { $result = $ldap->connect($_POST['username'],$_POST['passwd']); // Connect to LDAP server for verifing username/password if($result == True) // Username/password correct. Do some configuration and load main frame. { $_SESSION["language"] = $_POST["language"]; // Write selected language in session session_register("ldap"); // Register $ldap object in session include("./main.php"); // Load main frame } else { if($ldap->server) { $error_message = _("Wrong Password/Username combination. Try again."); display_LoginPage($_SESSION['config']); // Username/password invalid. Return to login page. } else { $error_message = _("Cannot connect to specified LDAP-Server. Try again."); display_LoginPage($_SESSION['config']); // Username/password invalid. Return to login page. } } } } // Reload loginpage after a profile change elseif($_POST['action'] == "profileChange") { $config = new Config($_POST['profile']); // Recreate the config object with the submited profile display_LoginPage($config); // Load login page } // Load login page else { session_register("config"); // Register $config object in session $default_Config = new CfgMain(); $default_Profile = $default_Config->default; $config = new Config($default_Profile); // Create new Config object display_LoginPage($config); // Load Login page } ?>