";
}
// check if all password hashes are possible
if ((! function_exists('mHash')) && (! function_exists('sha1'))) {
StatusMessage("INFO", "Your PHP does not support MHash or sha1(), you will only be able to use CRYPT/PLAIN/MD5/SMD5 for user passwords!", "Please install MHash or update to PHP >4.3.");
echo "
";
}
// check if PHP has LDAP support
if (! function_exists('ldap_search')) {
StatusMessage("ERROR", "Your PHP has no LDAP support!", "Please install the LDAP extension for PHP.");
echo "
";
}
// check if PHP has gettext support
if (! function_exists('gettext')) {
StatusMessage("ERROR", "Your PHP has no gettext support!", "Please install gettext for PHP.");
echo "
";
}
// check file permissions
$writableDirs = array('config', 'config/profiles', 'config/pdf', 'sess', 'tmp', );
for ($i = 0; $i < sizeof($writableDirs); $i++) {
$path = realpath('../') . "/" . $writableDirs[$i];
if (!is_writable($path)) {
StatusMessage("ERROR", _('The directory %s is not writable for the web server. Please change your file permissions.'), '', array($path));
echo " ";
}
}
?>
" . 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'] .= "\n";
$_SESSION['header'] .= "\n ";
include("./main.php"); // Load main frame
}
else
{
if ($result === False)
{
$error_message = _("Cannot connect to specified LDAP server. Please try again.");
display_LoginPage($_SESSION['config']); // connection failed
}
elseif ($result == 81)
{
$error_message = _("Cannot connect to specified LDAP server. Please try again.");
display_LoginPage($_SESSION['config']); // connection failed
}
elseif ($result == 49)
{
$error_message = _("Wrong password/user name combination. Please try again.");
display_LoginPage($_SESSION['config']); // Username/password invalid. Return to login page.
}
else
{
$error_message = _("LDAP error, server says:") . "\n ($result) " . ldap_err2str($result);
display_LoginPage($_SESSION['config']); // other errors
}
}
}
}
// Reload loginpage after a profile change
elseif($_POST['profileChange']) {
$_SESSION['config'] = new Config($_POST['profile']); // Recreate the config object with the submited
display_LoginPage($_SESSION['config']); // Load login page
}
// Load login page
else
{
$_SESSION['loggedIn'] = false;
$default_Config = new CfgMain();
$default_Profile = $default_Config->default;
$_SESSION["config"] = new Config($default_Profile); // Create new Config object
display_LoginPage($_SESSION["config"]); // Load Login page
}
?>