= 5.1
if (version_compare(phpversion(), '5.1.0') < 0) {
	$criticalErrors[] = array("ERROR", "LAM needs PHP 5 greater or equal as 5.2.0!", "Please upgrade your PHP installation.");
}
// check file permissions
$writableDirs = array('sess', 'tmp');
for ($i = 0; $i < sizeof($writableDirs); $i++) {
	$path = realpath('../') . "/" . $writableDirs[$i];
	if (!is_writable($path)) {
		$criticalErrors[] = array("ERROR", 'The directory %s is not writable for the web server. Please change your file permissions.', '', array($path));
	}
}
// check session auto start
if (ini_get("session.auto_start") == "1") {
	$criticalErrors[] = array("ERROR", "Please deactivate session.auto_start in your php.ini. LAM will not work if it is activated.");
}
$memLimit = ini_get('memory_limit');
if (isset($memLimit) && ($memLimit != '') && (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')) {
	if (intval(substr($memLimit, 0, strlen($memLimit) - 1)) < 64) {
		$criticalErrors[] = array("ERROR", "Please increase the \"memory_limit\" parameter in your php.ini to at least \"64M\".");	
	}
}
// stop login if critical errors occured
if (sizeof($criticalErrors) > 0) {
	echo "\n";
	echo "\n\n";
	echo "\n
\n";
	echo "LDAP Account Manager \n";
	echo "\n";
	for ($i = 0; $i < sizeof($criticalErrors); $i++) {
		call_user_func_array("StatusMessage", $criticalErrors[$i]);
		echo "LDAP Account Manager -Login- 
		
			
		
			
				
					" . _("Want more features? Get LAM Pro!") . "";
						}
					?>
				 
				
					 
			 
		
		
				
					Pro: " . LAMVersion() . "    ";
						}
						else {
							echo "LDAP Account Manager: " . LAMVersion() . "    ";
						}
					?>
					 
				
	
connect($_POST['username'],$_POST['passwd']); // Connect to LDAP server for verifing username/password
		if($result === 0) // Username/password correct. Do some configuration and load main frame.
		{
			$_SESSION['loggedIn'] = true;
			$_SESSION['language'] = $_POST['language']; // Write selected language in session
			$current_language = explode(":",$_SESSION['language']);
			$_SESSION['header'] = "\n";
			$_SESSION['header'] .= "\n\n";
			$_SESSION['header'] .= "\n\n";
			$_SESSION['header'] .= "