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

<head>
    <?php include("head.php"); ?>
    <link href="assets/stylesheet/jquery.growl.css" rel="stylesheet" type="text/css" />
    
	<?php
	if(isset($_POST['register'])){
		$name=trim($_POST['name']);
		$email=trim($_POST['email']);
		$password=trim($_POST['password']);
		$phone=trim($_POST['phone']);
		$username=trim($_POST['username']);
		$usertype=trim($_POST['usertype']);
		$chk=$conn->query("select * from users where username='$username'");
		
		if(($chk->num_rows)>0){ ?>

			<script>
			$(document).ready(function() {
				$.growl.error({
					message: "Username Already Exist..!!Please Enter Another"
				});
			});
			</script> <?php
		}else{
			$chk1=$conn->query("select * from users where email='$email'");
			if(($chk1->num_rows)>0){ ?>

				<script>
				$(document).ready(function() {
					$.growl.error({
						message: "Email Already Exist..!!!"
					});
				});
				</script> <?php
			}else{
				echo $sql="insert into users(name,email,password,phone,username,usertype)values('$name','$email','$password','$phone','$username','$usertype')";
				$ins=$conn->query($sql);?>

				<script>
				$(document).ready(function() {
					$.growl.notice({
						message: "You are Registered Succesfull..!!!Please Login Now.."
					});
				});
				</script> <?php
			}
		}

	}
	?>
	<!-- 1 reel 3 story unboxing -->
</head>

<body class="blue-skin">
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div id="preloader">
        <div class="preloader"><span></span><span></span></div>
    </div>

    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <div id="main-wrapper">

        <!-- ============================================================== -->
        <!-- Top header  -->
        <!-- ============================================================== -->
        <!-- Start Navigation -->
        <?php include("header1.php"); ?>
        <!-- End Navigation -->
        <div class="clearfix"></div>
        <!-- ============================================================== -->
        <!-- Top header  -->
        <!-- ============================================================== -->

        <!-- ============================ Page Title Start================================== -->
        <div class="page-title">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 col-md-12">

                        <h2 class="ipt-title">Submit Property</h2>
                        <span class="ipn-subtitle">Just Submit Your Property</span>

                    </div>
                </div>
            </div>
        </div>
        <!-- ============================ Page Title End ================================== -->

        <!-- ============================ Submit Property Start ================================== -->
        <section class="gray-simple">

            <div class="container">
                <div class="row">


                    <h4 class="modal-header-title">Sign Up</h4>
                    <div class="login-form">
                        <form action="register.php" method="post">

                            <div class="row">

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <input type="text" class="form-control" name="name" required
                                                placeholder="Full Name">
                                            <i class="ti-user"></i>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <input type="email" class="form-control" name="email" placeholder="Email">
                                            <i class="ti-email"></i>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <input type="text" class="form-control" name="username"
                                                placeholder="Username">
                                            <i class="ti-user"></i>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <input type="password" class="form-control" name="password"
                                                placeholder="*******">
                                            <i class="ti-unlock"></i>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <input type="number" class="form-control" name="phone"
                                                placeholder="123 546 5847">
                                            <i class="lni-phone-handset"></i>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <div class="form-group">
                                        <div class="input-with-icon">
                                            <select class="form-control" name="usertype">
                                                <option value="customer">As a Customer</option>
                                                <option value="agent">As a Agent</option>
                                                <option value="agency">As a Agency</option>
                                            </select>
                                            <i class="ti-briefcase"></i>
                                        </div>
                                    </div>
                                </div>

                            </div>

                            <div class="form-group">
                                <button type="submit" name="register"
                                    class="btn btn-md full-width btn-theme-light-2 rounded">Sign Up</button>
                            </div>

                        </form>
                    </div>

                    <div class="text-center">
                        <p class="mt-5"><i class="ti-user mr-1"></i>Already Have An Account? <a href="login.php"
                                class="link">Go For LogIn</a></p>
                    </div>

                </div>

            </div>

        </section>


        <a id="back2Top" class="top-scroll" title="Back to top" href="#"><i class="ti-arrow-up"></i></a>


    </div>
    <!-- ============================================================== -->
    <!-- End Wrapper -->
    <!-- ============================================================== -->

    <?php include("footer.php"); ?>
    <!-- ============================================================== -->
    <!-- All Jquery -->
    <!-- ============================================================== -->
    <?php include("foot.php"); ?>
    <!-- ============================================================== -->
    <!-- This page plugins -->
    <!-- ============================================================== -->

    <script src="assets/javascript/jquery.growl.js" type="text/javascript"></script>
    <script src="assets/js/dropzone.js"></script>
    <!-- New Js -->


</body>

</html>