<!DOCTYPE html>
<?php
session_start();
if (!empty($_SESSION['user_name'])) {
    header('Location:manage_questions.php');
}
require_once ("db/AppManager.php");
$pm = AppManager::getPM();
include 'fragments/head.php';
?>
<body style="background: #fff">
    <div class="row center_" >
        <div class="col-lg-8" style="margin-left:100px;">
            <h1 class="page-header">
                Login
            </h1>
        </div>
    </div>
    <div class="row center_">
        <div class="col-lg-8"  style="margin-left:100px;">
            <?php
            if (!empty($_SESSION['error_log']) && $_SESSION['error_log'] == "1") {
                ?>
                <div class="alert alert-danger">
                    <strong>Invalid user name or password</strong>
                </div>
                <?php
            }
            ?>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">Login Details</h3>
                </div>
                <div class="panel-body">
                    <form method="post" action="function.php">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>User Name : </label>
                                    <input class="form-control" name="user_name"  type="text" required="">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label>Password : </label>
                                    <input class="form-control" name="password"  type="password" required="">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <input type="hidden" name="action" value="login">
                                    <br>
                                    <button type="submit" class="btn btn-primary pull-right">Login</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php include 'fragments/js.php'; ?>
</body>
</html>
