include 'connectionclass/function.php';
include 'connectionclass/metencrypt.php';
$db = new MyConnection();
$db->connect();
mysql_query("SET NAMES 'UTF8'");
$error = "";
$localIP = getHostByName(getHostName());
if (isset($_POST['btnsave'])) {
    $txtusername = $_POST['txtusername'];
    $password = $_POST['txtpassword'];
    $cboLanguage = post('cboLanguage');
    $encrypted_txt = encrypt_decrypt('encrypt', $password);
    $select = $db->query("CALL spUserAccSelete('" . $txtusername . "','" . $encrypted_txt . "');");
    $numrow = $db->dbCountRows($select);
    if ($numrow > 0) {
        $row = $db->fetch($select);
        $UserID = $row->UserID;
        $Level = $row->UserLever;
        $BranchID = $row->BranchID;
        $BranchName = $row->BranchName;
        $_SESSION['UserID'] = $UserID;
        $_SESSION['user'] = $txtusername;
        $_SESSION['Level'] = $Level;
        $_SESSION['BranchID'] = $BranchID;
        $_SESSION['BranchName'] = $BranchName;
        $_SESSION['startDate'] = date("Y-m-d H:i:s");
        $_SESSION['cboLanguage'] = $cboLanguage;
        if ($Level == 2) {
            cRedirect('frmTransfer.php');
        } else {
            if ($Level == 1) {