<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
require("includes/function.php");

$zdir = $dbname;
$zcomp = 1;
$zdbroot = $zdir;
$focusfield = "user";
$usertype = $_SESSION["usertype"];
$username = $_SESSION["username"];

if (isset($_POST["submit"])) {

    $series = $_POST["series"];
    $_SESSION["series_" . $dbname] = $series;


    header("Location: menu.php");
}
include("includes/linkshead.php");
?>
</head>
<body>
    <!-- Page container -->
    <div class="page-container login-container">

        <!-- Page content -->
        <div class="page-content">

            <!-- Main content -->
            <div class="content-wrapper">

                <!-- Content area -->
                <div class="content">

                    <!-- Simple login form -->
                    <form action="" method="POST">
                        <div class="panel panel-body login-form">
                            <div class="text-center">
                                <div class="icon-object border-slate-300 text-slate-300"><i class="icon-reading"></i></div>
                                <h5 class="content-group">Login to your account <small class="display-block">Enter your credentials below</small></h5>
                            </div>

                            <div class="form-group has-feedback has-feedback-left">
                                <select  name="series"  class="form-control select2" style="height:33px;width: 85%">
                                    <?php
                                    $getseries = mysqli_query($conn, "SELECT `code`,`name` FROM `series` ORDER BY `name`") OR die(mysqli_error($conn));
                                    while ($row = mysqli_fetch_array($getseries)) {
                                        echo "<option value=\"$row[code]\">$row[name]</option>";
                                    }
                                    ?>
                                </select>
                                <div class="form-control-feedback">
                                    <i class="icon-user text-muted"></i>
                                </div>
                            </div>

                            <div class="form-group">
                                <button type="submit" name="submit" class="btn btn-primary btn-block">Sign in <i class="icon-circle-right2 position-right"></i></button>
                            </div>
                        </div>
                    </form>
                    <!-- /simple login form -->
                </div>
                <!-- /content area -->
            </div>
            <!-- /main content -->
        </div>
        <!-- /page content -->
    </div>
    <!-- /page container -->
    <?php include("includes/linksfoot.php") ?>
</body>

</html>
