
<?php
require 'db.php';
session_start();
$today= getdate();
?>
<!doctype html>
<html lang="cs">
    <head>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="iAgriculture">
        <meta name="author" content="marek vorel">
        <link rel="icon" href="ia.ico">

        <title>iAgriculture</title>      
        <!-- Bootstrap core CSS -->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/bootstrap.css" rel="stylesheet">
        <!-- Custom styles for this template -->
        <link href="signin.css" rel="stylesheet">
        <!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> -->
        <script type="text/javascript">
        
        function sigg(){
            document.getElementById("signin").style.display = "none";
            document.getElementById("register").style.display = "block";
        }
        function regg(){
            document.getElementById("register").style.display = "none";
            document.getElementById("signin").style.display = "block";
        }
        
        </script>        
    </head>  
    <?php
    //načtení přihlašovací nebo registračnoho skriptu 
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        if (isset($_POST['login'])) {
            require 'login.php';
        } elseif (isset($_POST['register'])) {
            require 'register.php';
        }
    }
    ?>
    <body class="text-center" id="page-top">
        <!--navigace-->
        <nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
            <a class="navbar-brand font-weight-bold" href="#page-top">iAgriculture</a>
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarResponsive">
                <ul class="navbar-nav ml-auto">
                    <li class="nav-item js-scroll-trigger">
                        <a class="nav-link " href="#about">O projektu</a>
                    </li>            
                    <li class="nav-item">
                        <a class="nav-link " href="#contact">Kontakt</a>
                    </li>
                </ul>
            </div>
        </nav>
        <!-- konec navigace-->

        <header class="masthead ">
            <div class="container align-items-center">
                <div class="row">
                    <form action="index.php" method="post" autocomplete="off" class="form-signin" id="signin">                  
                        <h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
                        <label for="inputEmail" class="sr-only">Email address</label>
                        <input type="email" id="inputEmail" name="email" class="form-control" placeholder="Email address" required autofocus>
                        <label for="inputPassword" class="sr-only">Password</label>
                        <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required>
                        <div class="checkbox mb-3">
                            <label>
                                <input type="checkbox" value="remember-me"> Remember me
                            </label>
                        </div>
                        <button class="btn btn-lg btn-primary btn-block" type="submit" name="login">Sign in</button> 
                        <a onclick="sigg();" href="#" class="text-center "  id="regg">Create an account </a>
                    </form>
                    <form action="index.php" method="post" autocomplete="off" class="form-signin" id="register">
                        <h1 class="h3 mb-3 font-weight-normal">Please register</h1>
                        <label for="fristName" class="sr-only">First name</label>
                        <input type="text" id="fristName" name='firstname' class="form-control" placeholder="First name" required autofocus>
                        <label for="lastName" class="sr-only">Last name</label>
                        <input type="text" id="lastName" name='lastname' class="form-control" placeholder="Last name" required autofocus>
                        <label for="inputEmail" class="sr-only">Email address</label>
                        <input type="email" id="inputEmail" name='email' class="form-control" placeholder="Email address" required autofocus>
                        <label for="setPassword" class="sr-only" >Set password</label>
                        <input type="password" class="form-control" name='password' placeholder="Set password" required autofocus>
                        <button class="btn btn-lg btn-primary btn-block" type="submit" name="register">Register</button>
                        <a onclick="regg();" href="#" class="text-center "  id="loginn" >Sign in </a>
                    </form>
                </div>
            </div>
        </header>
        <section id="about" class="masthead"> 
            <div class="container ">
                <div class="row">
                    <div class="col-lg-8 mx-auto text-center">
                        <h2 class="section-heading text-white">O projektu</h2>
                        <hr class="light my-4">
                        <p class="text-faded mb-4">
                            Tato webová aplikace byla vytvořena pro účely diplomové práce „Využití LPWAN sítí v zemědělství“. Po přihlášení do aplikace je možné sledovat data vlhkosti a teploty z bezdrátového senzoru.
                        </p>
                        <hr class="my-4" style="border-style: dashed;width: 30px">
                        <p class="text-faded mb-4">
                            This web application was made for master's thesis purpose called “Application of LPWAN in agriculture”. After login into application you are able to see humidity and temperature data from remote sensor.
                        </p>
                    </div>
                </div>
            </div>
        </section>
        <section id="contact" class="masthead"> 
            <div class="container ">
                <div class="row">
                    <div class="col-lg-8 mx-auto text-center">
                        <h2 class="section-heading text-white">Kontakt</h2>
                        <hr class="light my-4">
                        <p class="text-faded mb-4">
                            Pokud se chcete dozvědět více, nebo máte nějaké dotazy, neváhejte mě kontaktovat.
                        </p>
                        <div class="row">
                            <div class="col-lg-4 ml-auto ">
                                <p>Jméno: Bc. Marek Vorel</p>
                            </div>
                            <div class="col-lg-4 mr-auto ">
                                <p>email: <a href="mailto:info@iagriculture.cz">info@iagriculture.cz</a></p>
                            </div>
                            <p class="mt-5 mb-3 text-muted">&copy; 2018-<?=$today["year"]?></p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="js/bootstrap.min.js"></script>   
    </body>
</html>
