*
* Last Modified: 22nd February 2003
*
*/
error_reporting(0);
if (!(include("./modules/header.lib.php")))
{
die("
There was an error loading the header module
");
}
if (param("op", "POST") == "validate")
{
if ($params = auth_user(param("username", "POST"), md5(param("password", "POST"))))
{
if ($cookie_time != "")
{
// Find out the time the cookie should last
$cookie_time = time() + $cookie_time;
}
// Set the cookies
setcookie($cookie_user, param("username", "POST"), (int) $cookie_time);
setcookie($cookie_pass, md5(param("password", "POST")), (int) $cookie_time);
setcookie($cookie_lang, param("language", "POST"), (int) $cookie_time);
// Forward to the main page
redirect($scripts["main"]);
}
// Error! Add the error message to the instructions
$login["instructions"] .= "
" . $login["error"];
}
else if (param("op", "GET") == "out")
{
// Unset the cookies
setcookie($cookie_user);
setcookie($cookie_pass);
setcookie($cookie_lang);
}
// Build the languages drop down list
natcasesort($lang_name);
$langauges[] = $login["my_default"];
foreach ($lang_name as $key => $var)
{
if ($key == $default_lang)
{
$langauges[$key] = $var . " - " . $login["default"];
}
else
{
$langauges[$key] = $var;
}
}
$lang_list = dropdown($langauges, $lang);
// The user isn't validated so construct the page
$form = template($login, $script_dir . "/settings/templates/login.tpl");
$page = array("javascript" => "", "content" => $form, "languages" => $lang_list, "title" => $login["title"], "this" => $PHP_SELF, "copyright" => $copyright);
// Finish up by outputting the completed page
template($page, $script_dir . "/settings/templates/global.tpl");
?>