<div class="breadcrumb-area mb-20">

        <div class="container">

            <div class="row">

                <div class="col">

                    <div class="breadcrumb-container">

                        <ul>

                            <li><a href="<?php echo base_url();?>"><i class="fa fa-home"></i> Home</a></li>

                            <li class="active">Login - Register</li>

                        </ul>

                    </div>

                </div>

            </div>

        </div>

    </div>

    

	<!--=====  End of breadcrumb area  ======-->



	<!--=============================================

	=            Login register page content         =

	=============================================-->

	

	<div class="page-content mb-30">

		<div class="container">

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

				if($this->db->get_where("users",array("email"=>$_GET['email'],"act_link"=>$_GET['actcode']))->num_rows()>0){

					$this->db->where("email",$_GET['email']);

					$this->db->where("act_link",$_GET['actcode']);

					$this->db->update("users",array("act_status"=>"active"));

				?>

<div class="alert alert-success">Your Account is activated successfully. You can now login.</div>

<?php }else{?>

<div class="alert alert-danger">Your Account couldnot be activated.. Please try again.</div>

				<?php }} if(isset($_GET['signup'])){?>

                    <div class="alert alert-success">Sign up Successful. Please check your email for account activation link.</div>

                    <?php }?>

			<div class="row">

				<div class="col-sm-12 col-md-6 col-xs-12 mb-30">

                	<form action="" method="post" id="loginform" >

						<div class="login-form">

							<h4 class="login-title">Login</h4>



							<div class="row">

								<div class="col-md-12 col-12 mb-20">

									<label>Email Address*</label>

									<input class="mb-0" type="email" required name="username" placeholder="Email Address">

								</div>

								<div class="col-12 mb-20">

									<label>Password</label>

									<input class="mb-0" type="password" required name="password" placeholder="Password">

								</div>

								<div class="col-md-8">

									<div class="check-box d-inline-block ml-0 ml-md-2 mt-10">

										<input type="checkbox" id="remember_me">

										<label for="remember_me">Remember me</label>

									</div>

									

								</div>

								

								<div class="col-md-4 mt-10 mb-20 text-left text-md-right">

									<a href="#"> Forgotten pasward?</a>

								</div>



								<div class="col-md-12">

                                	<p id="loginerror"></p>

									<button class="btn btn-success login-btn" type="submit">Login</button>

                                    <a href="<?php echo $gauthUrl;?>" class="btn btn-danger"><i class="fa fa-google-plus"></i> Google Login</a>

                                    <a href="#" class="btn btn-primary"><i class="fa fa-facebook"></i> Facebook Login</a>

								</div>



							</div>

						</div>



					</form>

				</div>

                <script>

				$(document).ready(function(){

					$("#loginform").submit(function(e){e.preventDefault();

					var formdata=$(this).serialize();

					var loginusername=$("#loginusername").val();

					$(".login-btn").attr("disabled",true);

					$(".login-btn").html('<i class="fa fa-refresh fa-spin"></i>');

					//alert(formdata);

					$.ajax({

								 type: "POST",

								 url: '<?php echo base_url();?>home/login1',

								 data: {formdata:formdata},

								 success: function(response){//alert(response);

								// console.log(response);return false;

									 if(response==1){

										window.location.href = "<?php echo base_url();?>home"; 

									 }else if(response==100){

										 $(".inactivebar").slideDown();

										 $("#resend_mail").attr("href",loginusername);

										 $(".login-btn").removeAttr("disabled");

										 $(".login-btn").html('<i class="fa fa-sign-in"></i> Login');

										// $(".inactivebar").hide(5000);

									 }else{

										 $(".remeberme").hide();

										 $("#loginerror").html('<b class="text-danger">Invalid Username or Password.</b>');

										 $("#loginform").trigger("reset");

										 //$(".loginerror").hide(5000);

										 $(".login-btn").removeAttr("disabled");

										 $(".login-btn").html('<i class="fa fa-sign-in"></i> Login');

									 }

									 //$("#auction_form").html(response);

								 }

								 });

			});

		

					$("#signupform").submit(function(e){e.preventDefault();

							var formdata=$(this).serialize();

							$(".signupbtn").attr("disabled",true);

							$(".signupbtn").html('<i class="fa fa-refresh fa-spin"></i> Loading...');

							$.ajax({

								 type: "POST",

								 url: '<?php echo base_url();?>home/signupform_submit',

								 data: {formdata:formdata},

								 success: function(response){//alert(response);

									 if(response==1){$('#myModal2').modal('show');

										$(".signupbtn").removeAttr("disabled");

										$(".signupbtn").html('SIGN UP');

										window.location.href = "<?php echo base_url();?>home/login?signup=success"; 

									 }else{

										 $(".signupbtn").removeAttr("disabled");

										 $(".signupbtn").html('SIGN UP');

										 $(".signuperror").text(response);

										 $(".signuperror").show();

									 }

								 }

								 });

					});

				});

				</script>

				<div class="col-sm-12 col-md-6 col-xs-12">

					<form action="" method="post" id="signupform" class="signup_form">



						<div class="login-form">

							<h4 class="login-title">Register</h4>



							<div class="row">

								<div class="col-md-6 col-12 mb-20">

									<label>First Name</label>

									<input class="mb-0" type="text" name="fname" required placeholder="First Name">

								</div>

								<div class="col-md-6 col-12 mb-20">

									<label>Last Name</label>

									<input class="mb-0" type="text" name="lname" required placeholder="Last Name">

								</div>

								<div class="col-md-12 mb-20">

									<label>Email Address*</label>

									<input class="mb-0" type="email" name="email" required placeholder="Email Address">

								</div>

								<div class="col-md-6 mb-20">

									<label>Password</label>

									<input class="mb-0" type="password" name="password" required placeholder="Password">

								</div>

								<div class="col-md-6 mb-20">

									<label>Confirm Password</label>

									<input class="mb-0" type="password" name="cpassword" required placeholder="Confirm Password">

								</div>

                                <div class="col-md-4 col-xs-6">

                            	<label>Add Numbers</label>

                            	<h3 style="margin-top:5px;"><?php echo $num1.' + '.$num2;?>&nbsp;<a href="#" data-toggle="tooltip" title="Please do the robot check using this CAPTCHA!!"><i class="fa fa-exclamation-triangle"></i></a></h3>

                            </div>

                            <div class="col-md-2 col-xs-6">

                            	<label>Answer</label>

                                <input type="hidden" name="totres2" id="totres2" value="<?php echo $res;?>" />

                                <input type="text" value="" name="res" id="totres1" required>

                            </div>

                            

								<div class="col-12">

                                <div class="signuperror alert alert-danger" style="display:none;"></div>

									<button class="btn btn-success signupbtn" type="submit">Register</button>

								</div>

							</div>

						</div>



					</form>

				</div>

			</div>

		</div>

	</div>