<?php
require_once '../models/db_connection.php';

if (isset($_POST['send'])) {
    $email = $_POST['email'];
    $crypt = base64_encode($email);
    $sql = mysqli_query($conn,"SELECT * FROM users WHERE email = '$email'");
    if ($sql) {
        require_once('mail.php');

    }
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Regal Admin</title>
    <?php include("../templates/header.php"); ?>
</head>

<body>
    <?php
    if (isset($_GET["message"])) {
        $message = $_GET["message"];
        echo "<script>alert('" . $message . "')</script>";
    }
    ?>
    <div class="container-scroller">
        <div class="container-fluid page-body-wrapper full-page-wrapper">
            <div class="content-wrapper d-flex align-items-center auth px-0">
                <div class="row w-100 mx-0">
                    <div class="col-lg-4 mx-auto">
                        <div class="auth-form-light text-left py-5 px-4 px-sm-5">

                            <h4>Reset your Password</h4>
                            <h6 class="font-weight-light">Please provide us with your email</h6>
                            <form class="pt-3" action="" method="POST">
                                <div class="form-group">
                                    <input type="email" class="form-control form-control-lg" id="exampleInputUsername1" placeholder="enter your email" name="email" Required>
                                </div>

                                <?php
                                if (isset($sms)) {
                                    echo "<div class='mb-4 alert alert-success'>" . $sms . "</div>";
                                }
                                if (isset($err)) {
                                    echo "<div class='mb-4 alert alert-success'>" . $err . "</div>";
                                }
                                ?>
                                <div class="mt-3">
                                    <button class="btn btn-block btn-info btn-lg font-weight-medium auth-form-btn" type='submit' name="send">Send</button>
                                    
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- content-wrapper ends -->
        </div>
        <!-- page-body-wrapper ends -->
    </div>
    <?php include("../templates/inc_scripts.php"); ?>
</body>

</html>