File Manager
Viewing File: login.php
<?php
//Start the Session
header("X-Robots-Tag: noindex, nofollow", true);
session_start();
require('include/connectdb.php');
require_once 'include/class.user.php';
$reg_user = new USER();
//3. If the form is submitted or not.
//3.1 If the form is submitted
if (isset($_POST['acc_no']) and isset($_POST['upass'])) {
//3.1.1 Assigning posted values to variables.
$acc_no = $_POST['acc_no'];
$upass = $_POST['upass'];
$upass = ($upass);
//3.1.2 Checking the values are existing in the database or not
$query = "SELECT * FROM account WHERE acc_no='$acc_no' and upass='$upass'";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$count = mysqli_num_rows($result);
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no = '$acc_no'");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$log = $reg_user->runQuery("UPDATE account SET logins = logins + 1 WHERE '$acc_no'");
$status = $row['status'];
//3.1.2 If the posted values are equal to the database values, then session will be created for the user.
if ($count == 0) {
$msg = "<div class='alert alert-danger'>
<button class='close' data-dismiss='alert'>×</button>
Invalid Account No or Password!
</div>";
} elseif ($status == 'DISABLED') {
$msg = "<div class='alert alert-inverse'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Sorry! Your Account Has Been Disabled For Violation of Our Terms!</strong>
</div>";
}
elseif ($status == 'CLOSED') {
$msg = "<div class='alert alert-inverse'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Sorry! That Account No Longer Exist!</strong>
</div>";
}
elseif ($status == 'SUSPEND') {
$msg = "<div class='alert alert-inverse'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Sorry! This Account is Suspended Contact Customercare!</strong>
</div>";
} else {
//3.1.3 If the login credentials doesn't match, he will be shown with an error message.
$_SESSION['acc_no'] = $acc_no;
$_SESSION['acc_no'] = $acc_no;
// Redirect user to dashboard/summary.php
// header("Location: dashboard/summary.php");
}
}
//3.1.4 if the user is logged in Greets the user with message
if (isset($_SESSION['acc_no'])) {
$code = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
$sender = "Hightower Wealth Management"; /* sender id */
$message = "Please enter this code to continue proceed
$code";
$message = "
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>[SUBJECT]</title>
<style type='text/css'>
body {
padding-top: 0 !important;
padding-bottom: 0 !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
margin:0 !important;
width: 100% !important;
-webkit-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
-webkit-font-smoothing: antialiased !important;
}
.tableContent img {
border: 0 !important;
display: block !important;
outline: none !important;
}
a{
color:#382F2E;
}
p, h1{
color:#382F2E;
margin:0;
}
div,p,ul,h1{
margin:0;
}
p{
font-size:13px;
color:#99A1A6;
line-height:19px;
}
h2,h1{
color:#444444;
font-weight:normal;
font-size: 22px;
margin:0;
}
a.link2{
padding:15px;
font-size:13px;
text-decoration:none;
background:#2D94DF;
color:#ffffff;
border-radius:6px;
-moz-border-radius:6px;
-webkit-border-radius:6px;
}
.bgBody{
background: #f6f6f6;
}
.bgItem{
background: #2C94E0;
}
@media only screen and (max-width:480px)
{
table[class='MainContainer'], td[class='cell']
{
width: 100% !important;
height:auto !important;
}
td[class='specbundle']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
}
td[class='specbundle1']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
}
td[class='specbundle2']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
}
td[class='specbundle3']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
padding-bottom:20px !important;
}
td[class='specbundle4']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
text-align:center !important;
}
td[class='spechide']
{
display:none !important;
}
img[class='banner']
{
width: 100% !important;
height: auto !important;
}
td[class='left_pad']
{
padding-left:15px !important;
padding-right:15px !important;
}
}
@media only screen and (max-width:540px)
{
table[class='MainContainer'], td[class='cell']
{
width: 100% !important;
height:auto !important;
}
td[class='specbundle']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
}
td[class='specbundle1']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
}
td[class='specbundle2']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
}
td[class='specbundle3']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
padding-bottom:20px !important;
}
td[class='specbundle4']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
text-align:center !important;
}
td[class='spechide']
{
display:none !important;
}
img[class='banner']
{
width: 100% !important;
height: auto !important;
}
td[class='left_pad']
{
padding-left:15px !important;
padding-right:15px !important;
}
.font{
font-size:15px !important;
line-height:19px !important;
}
}
</style>
<script type='colorScheme' class='swatch active'>
{
'name':'Default',
'bgBody':'f6f6f6',
'link':'ffffff',
'color':'99A1A6',
'bgItem':'2C94E0',
'title':'444444'
}
</script>
</head>
<body paddingwidth='0' paddingheight='0' bgcolor='#d1d3d4' style=' margin-left:5px; margin-right:5px; margin-bottom:0px; margin-top:0px;padding-top: 0; padding-bottom: 0; background-repeat: repeat; width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;' offset='0' toppadding='0' leftpadding='0'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' class='tableContent bgBody' align='center' style='font-family:Helvetica, Arial,serif;'>
<!-- =============================== Header ====================================== -->
<tr>
<td class='movableContentContainer' >
<div class='movableContent' style='border: 0px; padding-top: 0px; position: relative;'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' valign='top'>
<tr><td height='25' colspan='3'></td></tr>
<tr>
</tr>
</table>
</div>
<div class='movableContent' style='border: 0px; padding-top: 0px; position: relative;'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' valign='top'>
<tr><td height='2' ></td></tr>
<tr>
<td height='200' bgcolor='#fdfefe'>
<table align='center' border='0' cellspacing='0' cellpadding='0' class='MainContainer'>
<tr>
<td></td>
</tr>
<tr>
<td></td>
<td valign='top'>
<table width='300' border='0' cellspacing='0' cellpadding='0' align='center' valign='top'>
<tr>
<td valign='top'>
<div class='contentEditableContainer contentTextEditable'>
<div class='contentEditable' >
<h1 style='font-size:20px;font-weight:normal;color:blue;line-height:19px;'>Hello $fname $lname , </h1>
</div>
</div>
</td>
</tr>
<tr><td height='18'></td></tr>
<tr>
<td valign='top'>
<div class='contentEditableContainer contentTextEditable'>
<div class='contentEditable' >
<p style='font-size:13px;color:blue;line-height:19px;'>Please use the One Time Password OTP $code to complete your Login Process <br>
</p>
</div>
</div>
</td>
</tr>
<tr><td height='1'></td></tr>
</table>
</td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height='0' ></td></tr>
</table>
<div class='movableContent' style='border: 0px; padding-top: 0px; position: relative;'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' valign='top'>
<tr>
<td>
<table width='600' border='0' cellspacing='0' cellpadding='0' align='center' valign='top' class='MainContainer'>
<tr>
<td>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center' valign='top'>
<tr>
<td>
</td>
</tr>
<tr>
<td valign='top' align='center'>
<div class='contentEditableContainer contentTextEditable'>
<div class='contentEditable' >
<p style=' font-weight:bold;font-size:13px;line-height: 30px;'>Hightower Wealth Management</p>
</div>
<br> <div class='contentEditableContainer contentTextEditable'>
<div class='contentEditable' >
<p style='#F00; font-size:13px;line-height: 15px;'>This message is sent to this email to $fname <br /> <br /> <center><b>How do I know this is not a fake email?</b></center> <br />
An email really coming from us will address you by your registered first and last name or your business name. It will not ask you for sensitive information like your password, bank account or credit card details.<br /><br />
</p>
<p style='#F00; font-size:13px;line-height: 15px;'>Remember not to click any links in suspicious looking emails. </p>
</div>
</div> </div>
<div class='contentEditableContainer contentTextEditable'>
<div class='contentEditable' >
<p style='color:#A8B0B6; font-size:13px;line-height: 15px;'> </p>
</div>
</div>
<div class='contentEditableContainer contentTextEditable'>
</div>
<div class='contentEditableContainer contentTextEditable'>
</div>
</td>
</tr>
<tr><td height='28'> </td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
";
$acc_no = $_SESSION['acc_no'];
$queri = " UPDATE account SET tmp_otp = '$code' WHERE acc_no ='$acc_no'";
$resulti = mysqli_query($connection, $queri) or die(mysqli_error($connection));
$subject = "Login Verification";
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no = '$acc_no'");
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($_SESSION['acc_no']) && $row['phone_verify'] == 1) {
header('Location: dashboard/pin_auth.php');
exit();
} else {
$reg_user->send_mail($row['email'], $message, $subject);
$phone = preg_replace('/[^0-9]/', '', $row['phone']);
$mobile_msg = "Dear " . $row['fname'] . ", Please use the One Time Passcode (OTP): " . $code . " to complete your login process";
$reg_user->otp($phone,$mobile_msg);
header('Location: dashboard/otp.php');
}
} else {
}
//3.2 When the user visits the page first time, simple login form will be displayed.
?>
<h1>
</h1>
<title>Login</title>
<?php include('authheader.php')?>
<div class="card card-bordered">
<div class="card-inner card-inner-lg">
<div class="nk-block-head">
<div class="nk-block-head-content">
<h4 class="nk-block-title">Sign-In</h4>
<div class="nk-block-des">
<strong>Access your banking panel using your account number and password.</strong>
</div>
</div>
</div>
<?php
if (isset($_GET['inactive'])) {
?>
<div class='alert alert-info col-4'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Sorry!</strong> This Account is not Activated Contact Customer Care Activate it.
</div>
<?php
}
?>
<?php if (isset($msg)) echo $msg; ?>
<form method="POST" >
<div class="response" style="display:none"></div>
<div class="form-group">
<div class="form-label-group">
<label class="form-label" for="acct">Account Number</label>
</div>
<input type="number" autofocus class="form-control form-control-lg" name="acc_no" placeholder="Enter your account number" required>
</div>
<input type="hidden" name="code" value="<?php echo $code; ?>"
<div class="form-group">
<div class="form-label-group">
<label class="form-label" for="pass">Password</label>
<a class="link link-primary link-sm" href="dashboard/reset_password.php">Forgot Password?</a>
</div>
<div class="form-control-wrap">
<!-- <a href="#" class="form-icon form-icon-right passcode-switch" data-target="password" onclick="myFunction()">
<em class="passcode-icon icon-show icon ni ni-eye"></em>
<em class="passcode-icon icon-hide icon ni ni-eye-off"></em>
</a> -->
<input type="password" autofocus class="form-control form-control-lg" name="upass" id="myInput" placeholder="Enter your password" required>
<input type="checkbox" onclick="myFunction()">Show Password
</div>
</div>
<script> function myFunction() {
var x = document.getElementById("myInput");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
</script>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
<!--
<center>
<div required id="requiredDiv" id="hcaptcha-demo" class="h-captcha" data-sitekey="a2986389-2d1c-422d-aa3f-05228791ff50" data-callback="onSuccess" data-expired-callback="onExpire"></div></center>
<script>
function onSuccess(token) {
// enable the submit button
document.getElementById('submitButton').disabled = false;
}
</script>
<div class="form-group">
<button id="submitButton" disabled class="btn btn-lg btn-primary btn-block" name="login" type="submit">Sign in</button>
-->
<div class="form-group">
<button class="btn btn-lg btn-primary btn-block" name="login" type="submit">Sign in</button>
<button class="btn btn-lg btn-primary btn-block" style="display:none" id="authHide" disabled>
<div class="spinner-border spinner-border-sm" role="status">
<span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
<span class="sr-only">Loading...</span>
</div>
Authenticating Account
</button>
</div>
</form>
<div class="form-note-s2 text-center pt-4"> New Customer? <a href="dashboard/applicationform.php">Create an account</a>
</div>
</div>
</div>
</div>
<?php include('authfooter.php')?>