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

$zdir = $dbname;
$zcomp = 1;
$zdbroot = $zdir;
$focusfield = "submit";
$usertype = $_SESSION["usertype"];
$username = $_SESSION["username"];
$getusercode = mysqli_query($conn, "SELECT code,user FROM `passmain` WHERE user = '$username' ") OR die(mysqli_error($conn));
$gusercode = mysqli_fetch_array($getusercode);
$zroot = $_SESSION["zdbroot"];
$zroot1 = substr($zroot, 0, -4);
$zdb = $_SESSION["zdbyear_" . $dbname];

// browse($zdb);
mysqli_select_db($conn, $zdb);
if (isset($_POST["submit"])) {
    $tourcode = $_POST["cmbtour"];
    $getcomp = mysqli_query($conn, "SELECT * FROM `tour` WHERE `code`='$tourcode'") or die(mysqli_error($conn));
    $fetcomp = mysqli_fetch_array($getcomp);
    $tourname = $fetcomp["name"];
    $tourinit = $fetcomp["init"];
//    BROWSE($tourinit);
    $_SESSION["tourinit"] = $tourinit;
    $_SESSION["tourcode"] = $tourcode;
    $_SESSION["tourtype"] = $fetcomp['type'];
    $_SESSION["mantcs"] = $fetcomp['mantcs'];
    $_SESSION["tourname"] = $tourname;
    $_SESSION["fromdate"] = $fetcomp["fromdate"];
    $_SESSION["todate"] = $fetcomp["todate"];
    $_SESSION["tcsnew"] = $fetcomp['tcsnew'];
    $_SESSION["tcsslab"] = $fetcomp['tcsslab'];
//browse($_SESSION["tcsslab"]);
    header("Location: menu.php");
}

include("includes/linkshead.php");
?>



<style>

    body {

        animation: fadeInAnimation ease 3s;

        animation-iteration-count: 1;

        animation-fill-mode: forwards;

    }



    .select2 {

        font-weight: bold;

        color: #57606f;

    }



    @keyframes fadeInAnimation {

        0% {

            opacity: 0;

        }

        100% {

            opacity: 1;

        }

    }

    .shadow2 {

        box-shadow: 0 7px 30px -10px rgba(150,170,180,0.5);

        padding: 40px;

        background: #fff;

        max-width: 360px;

        border-radius: 20px;

        margin: 60px auto;

        border: 1px;

    }

    .btn-submit {

        width: 100%;

        height: 50px;

        font-size: 20px;

        font-weight: bold;

        border-radius: 7px;

        background-color: #2fbffe;

    }

    .ttext {

        font-weight: bold;

        color: #57606f;

    }

    .compTxt {

        font-weight: bold;

        color: #57606f;

    }

</style>



</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 shadow2">

                            <div class="text-center">

                                <!--<div class="icon-object border-slate-300 text-slate-300"><i class="icon-reading"></i></div>-->

                                <h4 class="content-group compTxt">Select Tour</h4>

                            </div>



                            <div class="form-group has-feedback has-feedback-left text-center">

                                <select id='cmbyear' name="cmbtour"  class="form-control select2" style="height:auto;width: 100%">

                                    <?php
                                    $year = mysqli_query($conn, "SELECT * FROM `tour` order by `code` DESC") OR die(mysqli_error($conn));

                                    while ($row = mysqli_fetch_array($year)) {

                                        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" id="submit" name="submit" class="btn btn-primary btn-submit 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") ?>

    <script>

        $("#submit").focus();

    </script>

</body>

</html>

