diff --git a/lam/config/language.conf b/lam/config/language.conf new file mode 100644 index 00000000..ac6178f2 --- /dev/null +++ b/lam/config/language.conf @@ -0,0 +1,10 @@ +# LDAP Account Manager Language Configuration file + +# Each line consists of a : seperated entrys. The first entry is the link to the language definition, the second is the language description. Further entries are not used yet. +# Normally you don't have to edit this file manually. It is modified automatically when you add a new language in the Configuration-Site. + +# Englisch Language +english:English + +# German Language +german:Deutsch \ No newline at end of file diff --git a/lam/templates/login.inc b/lam/templates/login.inc new file mode 100755 index 00000000..31a0f50d --- /dev/null +++ b/lam/templates/login.inc @@ -0,0 +1,87 @@ + + + + +// loading available languages from language.conf file + +$languagefile = "../config/language.conf"; +if(is_file($languagefile) == True) +{ + $file = fopen($languagefile, "r"); + $i = 0; + while(!feof($file)) + { + $line = fgets($file, 1024); + if($line == "\n" || $line[0] == "#") continue; // ignore comment and empty lines + $value = explode(":", $line); + $languages[$i]["link"] = $value[0]; + $languages[$i]["descr"] = $value[1]; + $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."; +} +?> + + +
+echo _("Enter Username and Password for Account:"); ?>
+ if($error_message != "") { echo ""; echo _($error_message); echo "
"; } ?> + + + diff --git a/lam/templates/login.php b/lam/templates/login.php index 849bc8cc..aa691032 100644 --- a/lam/templates/login.php +++ b/lam/templates/login.php @@ -1,4 +1,4 @@ - - - -echo _("Enter Username and Password for Account:"); ?>
- - - + +// including ldap.php which provides basic ldap functions +include_once("../lib/ldap.php"); + +// checking if the submitted username/password is correct. +if($action == "checklogin") +{ + $config = new Config; + $ldap = new Ldap($config); + $result = $ldap->connect($username,$password); + if($result) + { + include("./main.php"); // Username/password correct. Loading main Frame. + } + elseif($result == "Unable to bind to Server!") + { + $error_message = "Wrong Password/Username combination. Try again."; + include("./login.inc"); // Username/password invalid. Returning to Login page. + } + elseif($result == "Unable to connect to Server!") + { + $error_message = "Cannot connect to specified LDAP-Server. Try again."; + include("./login.inc"); // Server not reachable. Returning to Login page. + } +} +// Loading Login page +else +{ +include("./login.inc"); +} +?>