
<?php $title = "Book Now";?>
<!DOCTYPE html>
<html lang="en">
<?php include("config.inc");?>

<?php include("head-tag.php");?>
<?php include("header.php");?>

<body>
    

<div class="inner-wrapper">



 <div class="page-wrapper">
    <div class="container">
	<div class="row justify-content-center">
	<div class="col-xl-8 col-lg-10 col-md-12 col-12 mt-3 ml-auto mr-auto">
            <?php
            if ((isset($_REQUEST['email'])) || (isset($_REQUEST['hash']))) {
                $var = 1;
                $email = mysqli_real_escape_string($connect, $_REQUEST['email']);
                $query = "SELECT * FROM app_users WHERE Email='$email'";
                $result = mysqli_query($connect, $query);
                if (mysqli_num_rows($result) > 0) {
                    $row = mysqli_fetch_assoc($result);
                    if ($_REQUEST['hash'] != $row['ehash']) {
                        $error_message = 'Invalid Request.';
                        $var = 0;
                    }
                } else {
                    $error_message = 'Invalid Request.';
                     $var = 0;
                }
                if ($var != 0) {
                    $update_query = "UPDATE app_users SET ehash='', emailverified=1 WHERE Email='$email'";
                    mysqli_query($connect, $update_query);
                    $success_message = 'Your email is verified successfully. <a href="index.php" style="color:green"> You can now login to our website.</a>';
                }
            }
            ?>
            <?php if(isset($success_message)){ ?>
            <div class="alert alert-success">
                <?php echo $success_message; ?>
            </div>
            <?php } ?>
            <?php if(isset($error_message)){ ?>
            <div class="alert alert-danger">
                <?php echo $error_message; ?>
            </div>
            <?php } ?>
        </div>
	</div>
</div>
</div>


<?php include("scripts.php");?>
    
<div class="sidebar-overlay" id="sidebar_overlay"></div>
</div>
</body>
</html>