<?php
	require_once 'inserts.php';
	if(
	isset($_POST['schema_id'])&&
	isset($_POST['invest_amount'])&&
	isset($_POST['wallet'])
	){
		
		$schema_id = mysqli_real_escape_string($conn,trim($_POST['schema_id']));
		$invest_amount = mysqli_real_escape_string($conn,trim($_POST['invest_amount']));
		$wallet = mysqli_real_escape_string($conn,trim($_POST['wallet']));
		
		if(
		!empty($schema_id) &&
		!empty($invest_amount) &&
		!empty($wallet) 
		){

	$first_plan_name = "Standard Plan";
	$first_plan_img = '<img class=investment-plan-icon src="../assets/global/images/xD7JO6pA0Wj2vbyp9FJsK.png.pagespeed.ic.ZbpcAEHyVU.png" alt=""/>';
	$first_plan_rate = 'Daily 25%';
	$first_plan_rate2 = '25% (Daily)';
	$first_plan_Investment = '$1,000';
	$first_plan_capital_back = 'Yes';
	$first_plan_return_type = 'Period';
	$first_plan_return_no = '5';
	$first_plan_withdrawal = 'Anytime';
	$badge1 = '';	
	
	$second_plan_name = "Corporate Plan";
	$second_plan_img = '<img class=investment-plan-icon src="../assets/global/images/xgn6bCbbpkTCtTWIuPzzP.png.pagespeed.ic._fGlGfgngK.png" alt=""/>';
	$second_plan_rate = 'Weekly 48%';
	$second_plan_rate2 = ' 48% (Weekly)';
	$second_plan_Investment = '$10,000';
	$second_plan_capital_back = 'No';
	$second_plan_return_type = 'Period';
	$second_plan_return_no = '5';
	$second_plan_withdrawal = 'Anytime';	
	$badge2 = '<div class=feature-plan>BEST SCHEMA</div>';
	
	$third_plan_name = "Offshore Plan";
	$third_plan_img = '<img class=investment-plan-icon src="../assets/global/images/xI79d1j4CUeMfRtGHs1nQ.png.pagespeed.ic.-dw2RHIcuP.png" alt=""/>';
	$third_plan_rate = 'Daily 70%';
	$third_plan_rate2 = '70% (Daily)';
	$third_plan_Investment ='$25,000';
	$third_plan_capital_back = 'No';
	$third_plan_return_type = 'Period';
	$third_plan_return_no = '5';
	$third_plan_withdrawal = 'Anytime';
	$badge3 = '';	

	
	$fourth_plan_name = "Platinum Plan";
	$fourth_plan_img = '<img class=investment-plan-icon src="../assets/global/images/x7oF6RLsG8iAPmNCCKnC7.png.pagespeed.ic.XfIxot2pgB.png" alt=""/>';
	$fourth_plan_rate = 'Daily 84%';
	$fourth_plan_rate2 = '84% (Daily)';
	$fourth_plan_Investment = '$50,000';
	$fourth_plan_capital_back = 'Yes';
	$fourth_plan_return_type = 'Period';
	$fourth_plan_return_no = '5';
	$fourth_plan_withdrawal = 'Anytime';	
	$badge4 = '';	
	
			
	if($schema_id==1){
		$plan_img = $first_plan_img;
		$plan_img = $first_plan_img;
		$plan_return_no = $first_plan_return_no;
		$new_capital_back = $first_plan_capital_back;
	}else	if($schema_id==2){
		$plan_img = $second_plan_img;
		$plan_img = $second_plan_img;
		$plan_return_no = $second_plan_return_no;
		$new_capital_back = $second_plan_capital_back;
	}else	if($schema_id==3){
		$plan_img = $third_plan_img;
		$plan_img = $third_plan_img;
		$plan_return_no = $third_plan_return_no;
		$new_capital_back = $third_plan_capital_back;
	}else	if($schema_id==4){
		$plan_img = $fourth_plan_img;
		$plan_img = $fourth_plan_img;
		$plan_return_no = $fourth_plan_return_no;
		$new_capital_back = $fourth_plan_capital_back;
	}else{}		
			
			
 $new_email = $mail;
 $new_icon = $plan_img;
 $new_plan = $schema_id;
 $new_amount = $invest_amount;
 $new_profit = 0;
 $new_period_remaining = $plan_return_no;
 $new_capital_back = $schema_id;
 $new_time = time() +  (2*((60*60)*24));
 $created_at =null;
 $updated_at = null;
 
	$stmt->execute();
	
		
	
	if(function_exists('note_msg')){
			try{
				note_msg("Successfully Invested",'../invest-logs/');
			}catch(Exception $e){
				// alert('message: '.$e->getMessage());
			}
	
	}else{
		alert('created');
	}
		}
		
	}
 $stmt->close();
// $conn->close();
	
?>