<?php 
require_once("../app/config.php");
session_start();
if(isset($_SESSION['offshore_userid']) ){
    redirect($url."/user");
}
$title='Sign up';
require_once("include/user_header.php");
require_once('../lib/geoplugin.class.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
?>
    <div class="page-content bg-white">
        <!-- Main content -->
        <div class="content-wrapper">
            <!-- Content area -->
            <div class="content d-flex justify-content-center align-items-center">
                <!-- Login form -->
                <form method="post" action="app/user/register" class="flex-fill">
                    <div class="row">

                        <div class="col-lg-6 offset-lg-3">
                        <?php 
                        if(!empty($_SESSION['offshore_regerror'])){?>
                            <div class="col-lg-12">
                              <div class="alert bg-white text-default alt-font alert-dismissible">
                                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                        <?php 
                        if($_SESSION['offshore_regerror']=='invaliddetails') {
                            echo'An account already exists for the details you entered';
                        }
                        unset($_SESSION['offshore_regerror']);?>                 
                                </div>
                            </div>
                        <?php }?>
                            <div class="mb-0">
                                <div class="card-body">
                                    <div class="text-center mb-3">
                                        <a href="./"><img src="asset/<?php echo $logo['image_link']; ?>" style="max-width:13%; height:auto;" class=""></a>
                                        <h5 class="mb-0 alt-font text-default">Create account</h5>
                                        <span class="d-block text-muted alt-font">All fields are required</span>
                                    </div>

                                    <div class="form-group form-group-feedback form-group-feedback-right">
                                        <input type="text" class="form-control alt-font" placeholder="Choose username" name="username" required>
                                        <div class="form-control-feedback">
                                            <i class="icon-user-plus text-muted"></i>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group form-group-feedback form-group-feedback-right">
                                                <input type="text" class="form-control alt-font" name="name" placeholder="Full name" required>
                                                <div class="form-control-feedback">
                                                    <i class="icon-user-check text-muted"></i>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="col-md-6">
                                            <div class="form-group form-group-feedback form-group-feedback-right">
                                                <input type="text" class="form-control alt-font" placeholder="Country" value="<?php echo $geoplugin->countryName;?>" readonly name="country">
                                                <div class="form-control-feedback">
                                                    <i class="icon-location4 text-muted"></i>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group form-group-feedback form-group-feedback-right">
                                                <div class="badge-indicator-absolute">
                                                    <input type="password" class="form-control alt-font" placeholder="Create password" name="password" required>
                                                    <span class="badge password-indicator-badge-absolute"></span>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="col-md-6">
                                            <div class="form-group form-group-feedback form-group-feedback-right alt-font">
                                                <input type="text" name="format-international-phone" class="form-control" placeholder="Enter Mobile number" required>
                                                <div class="form-control-feedback">
                                                    <i class="icon-phone text-muted"></i>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php if(!empty($_SESSION['offshore_regmail'])){?>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-group form-group-feedback form-group-feedback-right">
                                                <input type="email" class="form-control alt-font" name="email" placeholder="Your email" value="<?php echo $_SESSION['offshore_regmail'];?>" readonly required>
                                                <div class="form-control-feedback">
                                                    <i class="icon-mention text-muted"></i>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php }else{?>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-group form-group-feedback form-group-feedback-right">
                                                <input type="email" class="form-control alt-font" name="email" placeholder="Your email" required>
                                                <div class="form-control-feedback">
                                                    <i class="icon-mention text-muted"></i>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php }?>
                                    <div class="form-group">

                                        <div class="form-check">
                                            <label class="form-check-label text-default alt-font">
                                                <input type="checkbox" name="news" class="form-input-styled" value="1" checked data-fouc>
                                                Subscribe to monthly newsletter
                                            </label>
                                        </div>

                                        <div class="form-check">
                                            <label class="form-check-label text-default alt-font">
                                                <input type="checkbox" name="terms" class="form-input-styled" data-fouc required>
                                                Accept <a href="./terms">terms of service</a>
                                            </label>
                                        </div>
                                    </div>
                            <div class="form-group text-center">
                                <button type="submit" class="btn text-green-800 bg-green-800 rounded-round alt-font">Create account</button>
                            </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
                <!-- /login form -->

            </div>
            <!-- /content area -->


            <!-- Footer -->
            <!-- /footer -->

        </div>
        <!-- /main content -->

    </div>
<?php require_once("include/user_footer.php"); ?>