<?php include "main_includes/header.php"; ?>



<body class="bg-white">


    <section class="bg-white">
        <div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
            <a href="#" class="flex items-center mb-6 text-2xl font-semibold text-gray-900 text-white">
                <div class="rounded w-20 h-20">
                    <img src="assets/img/favicon.png">
                </div>
            </a>
            <div class="w-full rounded-lg shadow border md:mt-0 sm:max-w-md xl:p-0 bg-sky-800 border-sky-700">
                <div class="p-6 space-y-4 md:space-y-6 sm:p-8">
                    <center>
                        <h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl text-white">
                            Email Verification
                        </h1>

                    </center>
                    <div class="text-gray-300 font-bold">


                        <?php
                        if (isset($_GET['verification'])) {

                            extract($_GET);
                            $verification = base64_decode($verification);

                            $user = User::find_by_id($verification);

                            if ($user) {
                                $user->status = 1;
                                if ($user->save()) {
                                    $_SESSION['user_id'] = $user->id;

                                    ?>
                                    <center class="m-5">
                                        <h2 class="text-success">Verification Successfuly</h2>
                                        <p>Your account is activated, You can now Log into your account</p>
                                    </center>
                                    <?php
                                } else {

                                    ?>

                                    <center class="m-5">
                                        <h2 class="text-warning">Verification Failed</h2>
                                        <p>Account alredy activated</p>
                                    </center>
                                    <?php
                                }
                            } else {

                                ?>
                                <center class="m-5">
                                    <h2 class="text-danger">Verification Failed</h2>
                                    <p>Invalid Verification code</p>
                                </center>
                                <?php
                            }
                        }
                        ?>
                    </div>
                    <div
                        class="p-2 text-gray-400 px-1 pt-0 text-center bg-transparent border-t-0 border-t-solid rounded-b-2xl lg:px-2">
                        <p class="mx-auto leading-normal text-sm">
                            Goto
                            <a href="sign-in"
                                class="relative z-10 font-bold text-transparent bg-sky-500 bg-clip-text">Sign-in</a>
                        </p>

                    </div>

                </div>
            </div>
        </div>

    </section>
    <?php
    include "./main_includes/loader_out.php";
    ?>
</body>



<script src="./assets/iziToast-master/dist/js/iziToast.js"></script>