<?php
session_start();  // Mula sesi
?>
<!DOCTYPE html>
<html lang="en">

<?php include('header.php'); ?>

<body class="skin-default card-no-border">
    <section id="wrapper">
        <div class="login-register" style="background-image:url(../assets/images/background/login-register.jpg);">
            <div class="login-box card">
                <div class="card-body">
                    <h4 class="text-center">Lupa Kata Laluan</h4>

                    <?php
                    // Jika ada error dalam sesi, papar melalui popup
                    if (isset($_SESSION['error'])) {
                        echo "<script>alert('" . $_SESSION['error'] . "');</script>";
                        unset($_SESSION['error']);
                    }

                    // Jika ada kejayaan dalam sesi, papar melalui popup
                    if (isset($_SESSION['success'])) {
                        echo "<script>alert('" . $_SESSION['success'] . "');</script>";
                        unset($_SESSION['success']); 
                    }
                    ?>

                    <form class="form-horizontal form-material" id="resetform" method="post" action="get_token.php">
                        <div class="form-group">
                            <label>Masukkan Emel Anda:</label>
                            <input type="email" name="email" class="form-control" required>
                        </div>
                        <div class="form-group text-center">
                            <button class="btn btn-info btn-rounded" type="submit">Hantar</button>
                            <a href="index.php" class="btn btn-secondary btn-rounded">Batal</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>

    <?php include('jquery.php'); ?>
</body>
</html>