<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
require("includes/function.php");
$spltype1 = $_SESSION["spltype_" . $dbname];

ini_set('display_errors', 1);
error_reporting(E_ERROR);

if (isset($_POST["submit"])) {
    $_SESSION["zdbyear_$dbname"] = 'apps2ai_' . $_SESSION["zdir"] . '_1_' . $_POST["cmbyear"];
    $_SESSION["tit"] = $_POST["cmbyear"];

    $user = $_SESSION["username_" . $dbname];
    $pass = $_SESSION["password_" . $dbname];
//    $spltype = $_SESSION["spltype_" . $dbname];
//    browse($pass);

    $getusercode = mysqli_query($conn, "SELECT * FROM `passmain` WHERE `user`='$user' and `password`='$pass'")or die(mysqli_error($conn));
    $gusercode = mysqli_fetch_array($getusercode);
    $usercode = $gusercode['code'];
    $spltype = $gusercode['spltype'];

    if ($spltype == '') {
        header("Location: menu.php");
    } else {
        header("Location: mainmenu.php");
    }
}
?>
<?php include("includes/files.php"); ?>
<link rel="stylesheet" href="assets/lib/magic/magic.css">
<!--<script>
    $(document).ready(function () {
        var year = $('#cmbyear').val();

        function showyear() {
            $.ajax({
                type: "GET",
                url: "ajaxyear.php",
                data: {qyear: year},
                success: function (result) {
                    $("#date").html(result);
                }

            });
            $('#date').css("height", "60px");
        }
        showyear();
    });
</script>-->
<head>
    <meta charset="UTF-8" />
    <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
    <title>LOMINO</title>    
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content="" />
    <meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
    <!--<meta name="author" content="Codrops" />-->
    <!--<link rel="shortcut icon" href="../favicon.ico">--> 
    <link rel="stylesheet" type="text/css" href="css/demo.css" />
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <!--    <link rel="stylesheet" type="text/css" href="css/animate-custom.css" />-->

</head>
<?php
if ($spltype1 == "") {
    $backcolr = "background-color:#5f2b54";
} else {
    $backcolr = "background-color:#b76e79";
}
?>
<body class="" style="background-color: #ffffff;">       
    <div class="container" onLoad="document.year.cmbyear.focus();
            showyear('ajaxyear.php?qyear=' + document.year.cmbyear.value);">
        <div class="">
            <div class="codrops-top">
                <a href="">
                </a>
                <span class="right">
                </span>
                <div class="clr"></div>
            </div>
            <header>
            </header><br><br><br>
            <section>				
                <div id="container_demo" >
                    <a class="hiddenanchor" id="toregister"></a>
                    <a class="hiddenanchor" id="tologin"></a>
                    <div id="wrapper">
                        <div id="login" class="animate form" style="background-color: #808080">
                            <form action="" name='year' class="form-signin " method="POST">
                                <h1>Year Selection</h1>
                                <p class="text-muted text-center">
                                    Select A Financial Year
                                </p>
                                <select id='cmbyear' name="cmbyear" onchange="return showyear();" class="form-control" style="height: 33px;">
                                    <?php
                                    $year = mysqli_query($conn, "SELECT * FROM `compyear` order by `lastdate` DESC") OR die(mysqli_error($conn));
                                    while ($row = mysqli_fetch_array($year)) {
                                        echo "<option value=\"$row[finyear]\">$row[finyear]</option>";
                                    }
                                    ?>
                                </select>
                                <br/>
                                <!--<div id='date' class="form-control"></div>--><br/>
                                <p class="log button"> 
                                    <button class="form-control" style="<?php echo $backcolr ;?>;height: 40px; color: white; border-color: white;" name='submit' type="submit" autofocus >Sign in</button>
                                </p>
                            </form>
                        </div>
                    </div>
                </div>  
            </section>
        </div>
</body>
</html>


