<?php
include_once('class.login.php');
$loginObj = new login($configObj);
$configObj->glTplObj->change_path($configObj->currentModulePath . 'html/templates/');
$configObj->glTplObj->set('configObj', $configObj);
$action = $_REQUEST['action'];
switch ($action) {
    case 'frgtpassword':

        $loginObj->varpostdata = $_REQUEST;
        if (!$loginObj->sendmail()) {
            echo $configObj->glTplObj->process('forgotpassword.tpl.php');
        }

        break;
    case 'logout':
        session_start();
        session_unset();
        session_destroy();
        $configObj->glLibraryObj->header_redirect("index.php");
        break;

    default:
        if (!$configObj->glSessionObj->is_set('admin_id')) {
            $loginObj->varpostdata = $_REQUEST;
            $loginObj->userlogin();
            $configObj->glSessionObj->set('admin_login', "");
            $LoginCookie = $configObj->glLibraryObj->requestGetCookie('tml_CookieLogin', array());
            if (!empty($LoginCookie)) {
                $username = $LoginCookie['user'];
                $passowrd = $LoginCookie['pwd'];
                $chkrememberme = $LoginCookie['chkrememberme'];
                $configObj->glTplObj->set('username', $username);
                $configObj->glTplObj->set('passowrd', $passowrd);
                $configObj->glTplObj->set('chkrememberme', $chkrememberme);
            }
            echo $configObj->glTplObj->process('login.tpl.php');
        }
        break;
}
?>

