File Manager
Viewing File: pinupdate.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);
if ($stat == 'Dormant/Inactive') {
header('Location: summary.php?dormant');
exit();
}
if (isset($_POST['reset-pin'])) {
$pass = $_POST['pin_auth1'];
$cpass = $_POST['pin_auth'];
if ($cpass !== $pass) {
$msg = "<div class='alert alert-danger'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Sorry!</strong> Passwords Doesn't match.
</div>";
} else {
//notify the user via email and sms - your password has been changed
if (($_POST['oldpin']) == $row['pin_auth']) {
$timezone = date_default_timezone_get();
date_default_timezone_set($timezone);
$date = date('m/d/Y h:i:s a', time());
$subject = "Auth Pin successfully changed!";
$message = "Dear " . $row['fname'] . " your Internet banking Auth Pin has been changed " . $date . " if you did't do it ,Contact customercare Immediately";
$reg_user->send_mail($row['email'], $message, $subject);
$phone = preg_replace('/[^0-9]/', '', $row['phone']);
$mobile_msg = "Dear " . $row['fname'] . " your Internet banking Auth Pin has been changed " . $date . " if you did't do it ,Contact customercare Immediately";
//$reg_user->otp($phone,$mobile_msg);
$password = ($cpass);
$stmt = $reg_user->runQuery("UPDATE account SET pin_auth=:pin_auth WHERE acc_no=:acc_no");
$stmt->execute(array(":pin_auth" => $password, ":acc_no" => $_SESSION['acc_no']));
$msg = "<div class='alert alert-success'>
<button class='close' data-dismiss='alert'>×</button>
Auth Pin Changed!
</div>";
} elseif (empty($pass) || empty($cpass)) {
$msg = "<div class='alert alert-success'>
<button class='close' data-dismiss='alert'>×</button>
Fill out the new and confirm Auth Pin!
</div>";
} else {
$msg = "<div class='alert alert-success'>
<button class='close' data-dismiss='alert'>×</button>
Old Auth Pin doesn't match!
</div>";
}
}
}
include_once ('counter.php');
?>
<?php include ('mheader.php')?>
<div class="nk-content ">
<div class="container-fluid">
<div class="nk-content-inner">
<div class="nk-content-body">
<div class="nk-block-head nk-block-head-sm">
<div class="nk-block">
<div class="nk-block-head-content">
<h3 class="nk-block-title page-title">Change Pin</h3>
<div class="nk-block-des text-soft">
Account Number <p class="text-primary fw-bold fs-19px"><?php echo $row['acc_no']; ?></p>
<hr>
<p class="fs-19px"> <?php echo $row['fname']; ?> <?php echo $row['lname']; ?> </p>
</div>
<div class="d-flex p-2 bg-lighter mt-2">Account Balance :
<div id="show-balance"><span><?php echo $row['currency']; ?></span><?php echo $english_format_number = number_format( $row['a_bal'] , 2, '.', ','); ?></div>
<div class="ml-auto mt-10"><a href="javascript:" data-toggle="modal" data-target="#modal-account-summary"><em class="icon ni ni-calender-date-fill"></em> History</a></div>
</div>
</div><!-- .nk-block-head-content -->
</div><!-- .nk-block-between -->
</div><!-- .nk-block-head -->
<div class="nk-block">
<?php
if (isset($msg)) {
echo $msg;
}
?>
<div class="card card-bordered">
<div class="card-inner">
<h5>Change Pin</h5>
<hr style="margin-bottom: 10px">
<form method="POST" class="form-validate is-alter" novalidate="novalidate" id="apply-loan-formdata">
<div class="form-group">
<div class="text-info">
<em class="icon ni ni-info"></em>
Ensure you fill the form correctly please.
</div>
</div>
<div class="form-group">
<label class="form-label" for="loanaccount"> Old Pin</label>
<div class="form-control-wrap">
<input type="password" class="form-control" name="oldpin" placeholder="********">
</div>
</div>
<div class="form-group">
<label class="form-label" for="loanamount"> New Pin</label>
<div class="form-control-wrap">
<input type="password" class="form-control" name="pin_auth1" placeholder="********" required>
</div>
</div>
<div class="form-group">
<label class="form-label" for="loanmode"> Confrim New Pin</label>
<div class="form-control-wrap">
<input type="password" class="form-control" name="pin_auth" placeholder="********">
</div>
</div>
<div class="form-group">
<button type="submit" name="reset-pin" class="btn btn-lg btn-primary">Update Pin</button>
</div>
</form>
</div></div>
</div> </div> </div> </div> </div>
<?php include ('mfooter.php')?>