<?php
/**
 * 
 * @file login_sys.php
 * @copyright (c) 2005 - 2007 eifr.com
 * @license http://www.gnu.org/copyleft/gpl.html gnu/gpl
 * eifr is free software
 */

require_once('../../includes/inc_login.php');
require_once(EIFR_ROOT . 'libraries/template.php');

// echo $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$errormsg = '';

if (IS_SYSADMIN) {
    if (!isset($act)) {
        $act = '';
    } else if ($act == 'login') {
        $username = kPost('username');
        $username = Common::checkValid($username);
        $password = md5($password);

        $sys_username = "sysadmin"; //login username
        $sys_password = "21232f297a57a5a743894a0e4a801fc3"; // login password
        if ($username == $sys_username && $password == $sys_password) {
            $rs_array = array('parameter' => '',
                TF_USER_ID => 0,
                TF_USER_NAME => $sys_username,
                TF_USER_NICK => $sys_username,
                TFR_USER_CLASS_ID => -1
                );

            setSession('session_sysadmin', $sys_username);
            Common::setLoginSession($rs_array);

            header("Location:index.php");
        } else {
            $errormsg = $lang['checkLogin'];
        } 
    } 
} else {
    $errormsg = 'IS_SYSADMIN=false(' . DIR_INSTALL . 'includes/config.php)';
} 

$clTemplate = new Template('../' . DIR_TEMPLATE_NAME . '/' . SYS_DEFAULT_STYLE . '/main/');
$clTemplate -> assign_vars(array('sys_charset' => SYS_CHARSET,
        'adminStylePath' => SYS_ADMIN_STYLE_PATH,
        'soft_name' => SOFT_NAME,
        'soft_version' => SOFT_VERSION,
        'soft_copyright' => SOFT_COPYRIGHT,
        'soft_weburl' => SOFT_WEBURL,
        'errormsg' => $errormsg,
        'manage_title' => $lang['manageTitle']
        ));

$clTemplate -> set_filenames(array('body' => 'login.tpl.html'));
$clTemplate -> pparse("body");

?>

