<?php require('header.php');?>

<?php
//Loan  
     if ($_SERVER["REQUEST_METHOD"]=="POST") {

$loan_amount = mysqli_real_escape_string($db,$_POST["amount"]);
$loan_purpose = mysqli_real_escape_string($db, $_POST["loan_purpose"]);
$address1 = mysqli_real_escape_string($db,$_POST["address1"]);
$address2 = mysqli_real_escape_string($db, $_POST["address2"]);
$city = mysqli_real_escape_string($db,$_POST["city"]);
$state = mysqli_real_escape_string($db,$_POST["state"]);
$zip = mysqli_real_escape_string($db,$_POST["zip"]);


  //now send this email to client for password reset
  $to = $email ;
    
$subject = 'Loan Application';

$from = $site_email;
 
// Setting html content type for email sending
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Create email headers
$headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
     $emailmsg = ' <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="x-apple-disable-message-reformatting">
  <title></title>
  <!--[if mso]>
  <style>
    table {border-collapse:collapse;border-spacing:0;border:none;margin:0;}
    div, td {padding:0;}
    div {margin:0 !important;}
  </style>
  <noscript>
    <xml>
      <o:OfficeDocumentSettings>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
  </noscript>
  <![endif]-->
  <style>
    table, td, div, h1, p {
      font-family: Arial, sans-serif;
    }
    @media screen and (max-width: 530px) {
      .unsub {
        display: block;
        padding: 8px;
        margin-top: 14px;
        border-radius: 6px;
        background-color: #555555;
        text-decoration: none !important;
        font-weight: bold;
      }
      .col-lge {
        max-width: 100% !important;
      }
    }
    @media screen and (min-width: 531px) {
      .col-sml {
        max-width: 27% !important;
      }
      .col-lge {
        max-width: 73% !important;
      }
    }
    
    
    
   


  </style>
</head>

<body style="margin:0;padding:0;word-spacing:normal;background-color:#939297;">
  <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#939297;">
    <table role="presentation" style="width:100%;border:none;border-spacing:0;">
      <tr>
        <td align="center" style="padding:0;">
          <!--[if mso]>
          <table role="presentation" align="center" style="width:600px;">
          <tr>
          <td>
          <![endif]-->
          <table role="presentation" style="width:94%;max-width:600px;border:none;border-spacing:0;text-align:left;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
            <tr>
              <td style="padding:40px 30px 30px 30px;text-align:center;font-size:24px;font-weight:bold;">
                <a href="'.$site_url.'" style="text-decoration:none;"><img src="'.$site_image.'" width="10" alt="Logo" style="width:10%">&nbsp;<span style="color:black;">'.$site_name.'</a>
              </td>
            </tr>



            <tr>
              <td style="padding:30px;background-color:#ffffff;">
                <h1 style="margin-top:0;margin-bottom:16px;font-size:26px;line-height:32px;font-weight:bold;letter-spacing:-0.02em;"><span style="color:#ff3884">Loan Application in Progress!</span></h1>
                <h4>Dear <b>'.$firstname.' '.$lastname.'</b></h4>
                <br>
                <p>
                    Your Loan request for a sum of <b>$'.$loan_amount.'</b>. was successfully recieved by <b>'.$site_name.'</b></p>
                
                <br> 
                
                Please stay back as we access your application details. Requested amount will be sent to your account if the loan is approved.
                <br> 
            
                    <br>
                    <p style="margin:0;"><a href="'.$site_url.'/login.php" style="background: #ff3884; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; mso-padding-alt:0;text-underline-color:#ff3884"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:20pt">&nbsp;</i><![endif]--><span style="mso-text-raise:10pt;font-weight:bold;">Login Here</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a></p>
            


              </td>
            </tr>
            <tr>
              <td style="padding:0;font-size:24px;line-height:28px;font-weight:bold;">
                <a href="#" style="text-decoration:none;"><img src="'.$site_url.'/passuccess.png" width="450" alt="" style="width:100%;height:auto;display:block;border:none;text-decoration:none;color:#363636;"></a>
              </td>
            </tr>
            <tr>
              <td style="padding:35px 30px 11px 30px;font-size:0;background-color:#ffffff;border-bottom:1px solid #f0f0f5;border-color:rgba(201,201,207,.35);">

                <div class="col-lge" style="display:inline-block;width:100%;max-width:395px;vertical-align:top;padding-bottom:20px;font-family:Arial,sans-serif;font-size:16px;line-height:22px;color:#363636;">
                  
                 
                  <br><br>
                  
                  <p>Best of luck!</p>
                  
            <h4>'.$site_name.' Team</h4>
            </div>
                </div>
                
                

              </td>
            </tr>
            
        <br>

<tr>
              <td style="padding:30px;text-align:center;font-size:12px;background-color:#404040;color:#cccccc;">
                <p style="margin:0 0 8px 0;"><a href="http://www.facebook.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/facebook_1.png" width="40" height="40" alt="f" style="display:inline-block;color:#cccccc;"></a> <a href="http://www.twitter.com/" style="text-decoration:none;"><img src="https://assets.codepen.io/210284/twitter_1.png" width="40" height="40" alt="t" style="display:inline-block;color:#cccccc;"></a></p>
                <p style="margin:0;font-size:14px;line-height:20px;"><b>Legal:</b> This email message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please delete it from your computer. '.$site_name.', does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is acepted by '.$site_name.' in this regard and the recipient should carry out such virus and other checks as it considers appropriate. <br><br><a class="unsub" href="#" style="color:#cccccc;text-decoration:underline;"><b>&copy; '.$site_name.' 2022 </b></a></p>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>

 ';
 // Sending email
if(mail($to, $subject, $emailmsg, $headers)){


 
$msg =  '<div class="alert alert-success" role="alert"><b><img style="width=:20px;height:20px;" src="assets/images/icosucces.png"> &nbsp; Your Loan Request has been successfully submitted!. </b>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button></div>'
;

}else{
   $msg = '<div class="alert alert-danger" role="alert"><b> &nbsp; Sorry there was an error, Try again Later!. </b>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button></div>'
; 
}
}
?> 


        <!-- partial -->
        <div class="main-panel">
          <div class="content-wrapper">
            <div class="page-header">
              <h3 class="page-title"> LOAN APPLICATION</h3>
              <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="index.php">Home</a></li>
                  <li class="breadcrumb-item active" aria-current="page">Loans</li>
                </ol>
              </nav>
            </div>
            <div class="row">

            
              <div class="col-12 grid-margin">
                <div class="card">
                  <div class="card-body">
                    <h4 class="card-title">Request</h4>
                    
                    <?php echo $msg;?>
                    <br>
                    

                    <form class="form-sample" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="POST" name="form" onsubmit="return Traficate()">
                    
                      <!--<p class="card-description"> Address </p>-->

                      <div class="row">
                        
                    
                        <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">Amount</label>
                            <div class="col-sm-9">
                              <input type="text" name="amount" class="form-control" required/>
                            </div>
                          </div>
                        </div>
                  
                                            <div class="col-md-6">
                                                       

                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">Loan Purpose</label>
                            <div class="col-sm-9">
                              <select class="form-control" name="loan_purpose" required>
                                                                            <option selected disabled> SELECT</option>
                                 <option value="DEBT-CONSOLIDATION"> DEBT CONSOLIDATION</option>
                                 <option value="CREDIT-CARD-CONSOLIDATION"> CREDIT-CARD CONSOLIDATION</option>
                             <option value="HOME-IMPROVMENT"> HOME IMPROVMENT</option>
                        <option value="HOME-BUYING"> HOME BUYING</option>
                        <option value="MAJOR-PURCHASE"> MAJOR PURCHASE</option>
                    <option value="CAR-FINANCING"> CAR FINANCING</option>
                    <option value="BUSINESS"> BUSINESS</option>
                    <option value="MOVING-RELOCATION"> MOVING & RELOCATION</option>
                    <option value="MEDICAL-EXPENSES"> MEDICAL EXPENSES</option>
                     <option value="LARGE-PURCHASE"> MAKE A LARGE PURCHASE</option>
                     <option value="VACATION"> PAY FOR A VACATION</option>
                     <option value="TUITION-FEES"> PAY TUITION FEES</option>
                     <option value="EXPENSES"> FUNERAL EXPENSES</option>
                     <option value="OTHER"> OTHER</option>



                              </select>
                            </div>
                          </div>
                        </div>
                      </div>
                      <br><br>
                        <h4 class="card-title">Personal Information</h4>
                    <br>
                                            <div class="row">
                        
                    
                        <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">Borrowers Mailing Address</label>
                            <div class="col-sm-9">
                              <input type="text" name="address1" class="form-control wide" required/>
                            </div>
                          </div>
                        </div>
                  
 
                      </div>
                       <div class="row">
                        
                    
                        <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">Address Line-2</label>
                            <div class="col-sm-9">
                              <input type="text" name="address2" class="form-control wide" required/>
                            </div>
                          </div>
                        </div>
                      </div>
<br>
                      <div class="row">
                        
                    
                        <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">State</label>
                            <div class="col-sm-9">
                              <input type="text" name="state" class="form-control" required/>
                            </div>
                          </div>
                        </div>
                  
 <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">City</label>
                            <div class="col-sm-9">
                              <input type="text" name="city" class="form-control" required>
                            </div>
                          </div>
                        </div>
                      </div>
 <div class="row">
                        
                    
                        <div class="col-md-6">
                          <div class="form-group row">
                            <label class="col-sm-3 col-form-label">Zip Code</label>
                            <div class="col-sm-9">
                              <input type="text" name="zip" class="form-control" required/>
                            </div>
                          </div>
                        </div>
                  
 
                      </div>


                      <br>
                         <div class="input-group-append">
<button type="submit" class="button-86" id="verify" role="button">Submit</button>
                        </div>
                    </form>
                  </div>
                </div>
              </div>
              
            </div>
          </div>
          <style>
            

/* CSS */
.button-86 {
  all: unset;
  width: 100px;
  height: 30px;
  font-size: 16px;
  background: transparent;
  border: none;
  position: relative;
  color: #f0f0f0;
  cursor: pointer;
  z-index: 1;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.button-86::after,
.button-86::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: -99999;
  transition: all .4s;
}

.button-86::before {
  transform: translate(0%, 0%);
  width: 100%;
  height: 100%;
  background: #28282d;
  border-radius: 10px;
}

.button-86::after {
  transform: translate(10px, 10px);
  width: 35px;
  height: 35px;
  background: #ffffff15;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 50px;
}

.button-86:hover::before {
  transform: translate(5%, 20%);
  width: 110%;
  height: 110%;
}

.button-86:hover::after {
  border-radius: 10px;
  transform: translate(0, 0);
  width: 100%;
  height: 100%;
}

.button-86:active::after {
  transition: 0s;
  transform: translate(0, 5%);
}

.wide{
    width:110%;
}
          </style>
          <!-- content-wrapper ends -->
          <!-- partial:../../partials/_footer.html -->
          
            <script>
function Traficate(){


        $("#verify").html("Processing...");
        return true;
        
    }
    
</script>
<?php require('footer.php');?>
