File Manager

Path: /home/heznutpr/log.heznutprivate.com/dashboard/

Viewing File: loan.php

<?php

session_start();

include_once ('../include/session.php');

require_once '../include/class.user.php';

if(!isset($_SESSION['acc_no'])){

	

header("Location: login.php");

exit(); 

}





$reg_user = new USER();



$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no=:acc_no");

$stmt->execute(array(":acc_no"=>$_SESSION['acc_no']));

$row = $stmt->fetch(PDO::FETCH_ASSOC);

$email = $row['email'];
$fname = $row['fname'];
$lname = $row['lname'];

if(isset($_POST['ticket']))

{

	$tc = rand(00000,99999);

	

	$email = trim($_POST['email']);

	$email = strip_tags($email);

	$email = htmlspecialchars($email);
	
	
	$mail = trim($_POST['mail']);

	$mail = strip_tags($mail);

	$mail = htmlspecialchars($mail);

	

	$sub = trim($_POST['subject']);

	$sub = strip_tags($sub);

	$sub = htmlspecialchars($sub);

	

	$msg = trim($_POST['msg']);

	$msg = strip_tags($msg);

	$msg = htmlspecialchars($msg);
	
	$status = trim($_POST['status']);

	$status = strip_tags($status);

	$status = htmlspecialchars($status);

	
	
	

	$tick = $reg_user->runQuery("SELECT * FROM ticket");

	

	$tick->execute();



	$show = $tick->fetch(PDO::FETCH_ASSOC);

	$date = $show['date'];

		if($reg_user->loan($tc,$email,$mail,$sub,$msg,$status))	

{			

			$id = $reg_user->lasdID();
			
			$message = "
		    <!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml' xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='x-apple-disable-message-reformatting'>
    <title></title>
    
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
    <!-- Web Font / @font-face : BEGIN -->
    <!--[if mso]>
        <style>
            * {
                font-family: 'Roboto', sans-serif !important;
            }
        </style>
    <![endif]-->

    <!--[if !mso]>
        <link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
    <![endif]-->

    <!-- Web Font / @font-face : END -->

    <!-- CSS Reset : BEGIN -->
    
    
    <style>
        /* What it does: Remove spaces around the email design added by some email clients. */
        /* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
        html,
        body {
            margin: 0 auto !important;
            padding: 0 !important;
            height: 100% !important;
            width: 100% !important;
            font-family: 'Roboto', sans-serif !important;
            font-size: 14px;
            margin-bottom: 10px;
            line-height: 24px;
            color:#8094ae;
            font-weight: 400;
        }
        * {
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%;
            margin: 0;
            padding: 0;
        }
        table,
        td {
            mso-table-lspace: 0pt !important;
            mso-table-rspace: 0pt !important;
        }
        table {
            border-spacing: 0 !important;
            border-collapse: collapse !important;
            table-layout: fixed !important;
            margin: 0 auto !important;
        }
        table table table {
            table-layout: auto;
        }
        a {
            text-decoration: none;
        }
        img {
            -ms-interpolation-mode:bicubic;
        }
    </style>

</head>

<body width='100%' style='margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f5f6fa;'>
    <center style='width: 100%; background-color: #f5f6fa;'>
        <table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#f5f6fa'>
            <tr>
               <td style='padding: 40px 0;'>
                    <table style='width:100%;max-width:620px;margin:0 auto;'>
                        <tbody>
                            <tr>
                                <td style='text-align: center; padding-bottom:25px'>
                                    <a href='#'><img style='height: 40px' src='$site_url/dashboard/admin/logo/logo.png' alt='logo'></a>
                                    <p style='font-size: 14px; color: #6576ff; padding-top: 12px;'>--***--</p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table style='width:100%;max-width:620px;margin:0 auto;background-color:#ffffff;'>
                        <tbody>
                            <tr>
                            
                                <td style='padding: 30px 30px 20px'>
                                    <p style='margin-bottom: 10px;'>Hi $fname $lname,</p>
                                    <br>
                                    <br>
                                    <p>Your Loan was successfully recieved! We will respond to your request within 24 hours. Below is the transaction summary.</p>
                                    <center>
                                        <h3>Loan Alert</h3>
                                     <table style='border:1px solid black;padding:2px;' width='400'>
                                        <tr>
                                            <th style='text-align:left;'>Loan ID Number</th>
                                            <td>$tc</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Amount</th>
                                            <td>$sub</td>
                                        </tr>
                                        <tr>
                                        <tr>
                                            <th style='text-align:left;'>Duration of Loan</th>
                                            <td>$mail</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Date Opened</th>
                                            <td>$date</td>
                                        </tr>
                                        <tr>
                                            <th style='text-align:left;'>Message</th>
                                            <td>$msg</td>
                                        </tr>
                                        
                                     </table>
                                    </center>
                                    <br>
                                    <p style='margin-bottom: 15px;'>Hope you'll enjoy the experience, we're here if you have any questions, drop us a line at <a style='color: #6576ff; text-decoration:none;' href='mailto:$site_email'>$site_email</a> anytime. </p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table style='width:100%;max-width:620px;margin:0 auto;'>
                        <tbody>
                            <tr>
                                <td style='text-align: center; padding:25px 20px 0;'>
                                    <p style='font-size: 13px;'>Copyright &copy; $site_title. All rights reserved.</p>
                                    <ul style='margin: 10px -4px 0;padding: 0;'>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-b.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-e.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-d.png' alt='brand'></a></li>
                                        <li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-c.png' alt='brand'></a></li>
                                    </ul>
                                    <p style='padding-top: 15px; font-size: 12px;'>This email was sent to you as a registered user of <a style='color: #6576ff; text-decoration:none;' href='$site_url'>$site_title</a>. To update your emails preferences <a style='color: #6576ff; text-decoration:none;' href='$site_url/login.php'>click here</a>.</p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
               </td>
            </tr>
        </table>
    </center>
</body>
</html>";
  
			
			$subject = "Your Loan[$tc] Has Been Recieved";
						
			$reg_user->send_mail($email,$message,$subject);	

			
			$msg = "

					<div class='alert alert-success'>

						<button class='close' data-dismiss='alert'>&times;</button>

						<strong>Alert!</strong> ~$subject~

                     

			  		</div>

					";

		}

		else

		{

			echo "Sorry, ticket was not opened";

		}		

}

include_once ('counter.php');

?>

<?php include 'mheader.php';
?>
<title>Loan Application</title>


<!-- content @s -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="components-preview wide-md mx-auto">
                                <div class="nk-block-head nk-block-head-lg wide-sm">
                                    <div class="nk-block-head-content">
                                        
                                        <h2 class="nk-block-title fw-normal">Loan Application</h2>
                                        
                                    </div>
                                </div><!-- .nk-block-head -->
                                <div class="nk-block nk-block-lg">

 <div class="card card-preview">
                                        <div class="card-inner">
                                            <div class="preview-block">
                                                <span class="preview-title-lg overline-title">Apply Form</span>
                        <form autocomplete="off" method="post" >
                             <?php if(isset($msg)) echo $msg;  ?>
     <div class="row gy-4">
                                                    
                                                    
                                                   <!-- <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-01">Card Type</label>
                                                            <div class="form-control-wrap">
                                                                <select name"cardtype" class="form-control" >
										        <option>TYPE OF CARD</option>
										        <option value="mastercard">Master Card</option>
										        <option value="visacard">Visa Card</option>
										        <option value="americaexpress">America Express Card</option>
										        <option value="discovercard">Discover Card</option>
										    </select>
                                                            </div>
                                                        </div>
                                                    </div>-->
                                                    
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-01">Full Name</label>
                                                            <div class="form-control-wrap">
                                                                <input  value="<?php echo $row['fname']; ?> <?php echo $row['lname']; ?>" type="text" readonly class="form-control"  >
                                                            </div>
                                                        </div>
                                                    </div>
                                                    
                                                  
                                                    
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-01">Email</label>
                                                            <div class="form-control-wrap">
                                                                <input  name="email" value="<?php echo $row['email']; ?> " type="text" readonly class="form-control"  >
                                                            </div>
                                                        </div>
                                                    </div>
                                                    
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-05">Amount (<?php echo $row['currency']; ?>)</label>
                                                            <div class="form-control-wrap">
                                                                <div class="form-text-hint">
                                                                    <span class="overline-title"><?php echo $row['currency']; ?></span>
                                                                </div>
                                                                <input type="text" required class="form-control" id="default-01" name="subject" placeholder="Enter amount">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-05">Duration of Loan</label>
                                                            <div class="form-control-wrap">
                                                                
                                                                <input type="text" required class="form-control" id="default-01" name="mail"  placeholder="Duration of Loan (e.g 12months)">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="form-label" for="default-textarea">Loan Reason</label>
                                                            <div class="form-control-wrap">
                                                                <textarea class="form-control  no-resize" name="msg" placeholder="Description " type="text" required>Loan Reason</textarea>
                                                            </div>
                                                        </div>
                                                    </div>
                                            </div>
                                             <input type="text" hidden class="form-control"  name="status"  value="inactive" > 
                                                <hr class="preview-hr">
                                                <button class="btn btn-primary" type="submit" name="ticket"> Apply for Loan</button> 
                                                
                                            </div>
                                        </div>
                                    </div><!-- .card-preview -->
                                    
                                </div><!-- .nk-block -->
                                
                               
                            </div><!-- .components-preview -->
                        </div>
                    </div>
                </div>
                <!-- content @e -->
                        
   <?php include 'mfooter.php';
?>