<?php

 //echo $product_name = $_POST['product'];



//session_start();

/*
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

	header ("Location: login.php");

}
		*/


$privilage = $_SESSION['privilage']; 
$app_name = $_SESSION['app_name'];
  $db_size = $_SESSION['db_size'];
$data_b = $_SESSION['d_b'];

$app_code = $_SESSION['app_code'];
$activation_date = $_SESSION['activation_date'];
$expiration_date = $_SESSION['expiration_date'];
$business_name = $_SESSION['biz_name'];
$business_nature = $_SESSION['biz_nature'];





?>


<?php

$error = "";

require 'config.php';


$db_handle = mysqli_connect(DB_SERVER, DB_USER, DB_PASS);

//$database = $_SESSION['database'];
$database = "lawpedc2_lbs_users";


$db_found = mysqli_select_db($db_handle, $database);
			
		//$SQL = "DELETE FROM product_table WHERE product_id=$txnid";
   //$query_del = mysqli_query($db_handle, $SQL);



  if($db_found){
	 

if(isset($_POST['A']))
{
	 
   
		
	    $biz_name = $_SESSION['biz_name'];
		$biz_nature = $_SESSION['biz_nature'];
		$admin_name = $_SESSION['privilage']; 
	
		$nation = $_POST['nation'] ;
		$city = $_POST['city'] ;
		$fone = $_POST['fone'] ;
		$email = $_POST['email'] ;
	
		$user_name=$_POST['pass'];
    	$pass=$_POST['pass'];
		$re_pass=$_POST['re_pass'];
		
		 $d_b=  'lawpedc2_'.str_shuffle($pass); 
	
		 $app_code = "LBS".rand(1000,10000);
	 $app_name =$_POST['app_name'];
	
	 $privilage =$_POST['privilage'];
	 $status =$_POST['status'];
	
	 $date = date("Y-m-d");
	
	

	if($pass==$re_pass)
	
	{
		
		
		//if( $biz_name or $biz_nature or $admin_name or $nation or $city or $fone =="")
			if( $biz_name =="" or $biz_nature==""  or $admin_name=="" or $nation=="" or $city==""or $fone =="" or $pass =="" or $re_pass=="")
		
		{
		
				
			$error = " one of the fields is blank";
		}

		else{
			
			$db_found = new mysqli(DB_SERVER, DB_USER, DB_PASS, $database );
	
		$SQL = $db_found->prepare("INSERT INTO login (biz_name,biz_nature,name,nation,city,fone,email,L1,L2,d_b,app_code,app_name,privilage,status,date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
			$SQL->bind_param('sssssssssssssss',$biz_name,$biz_nature, $admin_name,$nation,$city,$fone,$email,$user_name,$pass,$d_b,$app_code,$app_name,$privilage,$status,$date);
			$SQL->execute();
			
			header ("Location: inactive.php");
			
			//$error = "no blank";
		}
		
		
		
		
		
		
	}
	
	else{
		$error = "passwords mis-matched";
	
	}


	
	
	
	
	
	
	
}
	  
	  
	// header ("Location: inventory_ac.php");

	 
	  
  
  }
	  
  
else{
	
	$error =  "database not found";

	}

 

?>






	<html>
		
			<title>Delete_script</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->	
		 <link href="css/bootstrap-4.4.1.css" rel="stylesheet">
		
		
		
	<head>



	</head>
		
		<style>
			.loader {
  border: 16px solid #f3f3f3;
  border-radius: 30%;
  border-top: 5px solid blue;
  border-right: 5px solid green;
  border-bottom: 5px solid red;
  border-left: 5px solid yellow;
  width: 40px;
  height: 40px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 1s linear infinite;
}

		
		
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

			
			
			
		
		body, html {
background-color: #B00707;
			}
		</style>
	<body onLoad="spinner()">


			

		<div class="jumbotron" style="text-align: center">
		
		
		
		
		<div class="row">
			
			
			<div class="col-md-12">
			
			
				<table style="margin: auto;width:;background-color: " >
				
		
					<tr>
				<td>
				
		 			<span style="background-color: black; color: white;">  <?php echo $error; ?></span>
			<h3><b><span style="color: #8996C9">LBS <span style="color: red">APP BUILDER</span> </b></h3>
				
					<form METHOD ="POST" ACTION = "user_reg.php" style="width: 100%">
				
						
						<input type="hidden" value="LBS" name="app_name">
						<input type="hidden" value="admin" name="privilage">
						<input type="hidden" value="inactive" name="status">
						
						<table width="">
				
							<tr>
									<td>  
	
										<div class="input-group mb-3">
											
											
												
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Business Name</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="eg.Lawped Limited" aria-label="Username" aria-describedby="basic-addon1" value="" name="biz_name">
				
										</div>
										
										<div class="input-group mb-3">
											
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Nature of Business</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="eg.Provision Store,Supermarket,Gas station etc" aria-label="Username" aria-describedby="basic-addon1" value="" name="biz_nature">
				
										</div>
										
										
										
										
					
										<div class="input-group mb-3">
  					
											<div class="input-group-prepend">
    
												<span class="input-group-text" id="basic-addon1">Full Name</span>
  
												</div>
  
											<input type="text" class="form-control" placeholder="eg. Alaye David " aria-label="Username" aria-describedby="basic-addon1" name="admin_name" value="">

											
										</div>
										
											<div class="input-group mb-3">
											
											
												
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Nationality</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="eg.United State,Nigeria" aria-label="Username" aria-describedby="basic-addon1" value="" name="nation">
				
										</div>
										
										<div class="input-group mb-3">
											
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">City</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="eg. Warri,Ph,chigago etc" aria-label="Username" aria-describedby="basic-addon1" value="" name="city">
				
										</div>
										
										
										
										
											<div class="input-group mb-3">
											
											
												
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Phone No</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="please fill" aria-label="Username" aria-describedby="basic-addon1" value="" name="fone">
				
										</div>
										
										<div class="input-group mb-3">
											
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Email</span>
					
											</div>
										
											<input type="text" class="form-control" placeholder="please fill" aria-label="Username" aria-describedby="basic-addon1" value="" name="email">
				
										</div>
										
										
											<div class="input-group mb-3">
											
												
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Password</span>
					
											</div>
										
											<input type="password" class="form-control" placeholder="please fill" aria-label="Username" aria-describedby="basic-addon1" value="" name="pass">
				
										</div>
										
										<div class="input-group mb-3">
											
											<div class="input-group-prepend">
				
												<span class="input-group-text" id="basic-addon1">Re-Password</span>
					
											</div>
										
											<input type="password" class="form-control" placeholder="please fill" aria-label="Username" aria-describedby="basic-addon1" value="" name="re_pass">
												
												
												
												
										
												
				
										</div>
										
										
										
									
										
							
					</td>
					
	
						</tr>
							
					</table>
						<table>
						<td>
			<input type="submit" value="                    BUILD APP                 "  name = "A" style= "width:auto; height: 70px" class="btn btn-info" onClick="spinner()" > 
						</td>
							
							<td>
							
							<div class="loader" id="load" style="margin: auto"></div>
							</td>
							
							
				<td>		
						<a href = "../login.php"><input type="button" value=" BACK "  name = "" style= "width:auto; height: 70px" class="btn btn-danger" onClick="spinner()"> </a>
				</td>
											
								</table>
					</form>
		
		        
					
					
				
		</td>
					
			
	
				</tr>

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

	
		</body>
	
		</html>
<script>


		function spinner() {
  
			var x = document.getElementById("load");
	
	
	
  if (x.style.display === "none") {
    x.style.display = "block ";
	  
	  
  }
	else {
    x.style.display = "none";
  }
	
	
}
	
		
		
		


</script>