connect($username,$passwd); // Connect to LDAP server for verifing username/password if($result == True) // Username/password correct. Do some configuration and load main frame. { // setting language $language = explode(":", $language); putenv("LANG=" . $language[1]); setlocale(LC_ALL, $language[0]); bindtextdomain("lam", "../locale"); textdomain("lam"); include("./main.php"); // Load main frame session_register("ldap"); // Register $ldap object in session session_register("language"); // Register $language in session } else { if($ldap->server) { $error_message = "Wrong Password/Username combination. Try again."; include("./login.inc"); // Username/password invalid. Return to login page. } else { $error_message = "Cannot connect to specified LDAP-Server. Try again."; include("./login.inc"); // Server not reachable. Return to login page. } } } // Load login page else { session_register("config"); // Register $config object in session include_once("../lib/ldap.php"); // Includ ldap.php which provides Ldap class $config = new Config; // Create new Config object include("./login.inc"); // Load login page } ?>