<?php
session_start();

require('../includes/database.php');

if (isset($_SESSION['username']) && $_SESSION['password'] != "") {
} else {
    header("Location:index.php");
}
$username = $_SESSION['username'];


$username = $_SESSION['username'];
$password = $_SESSION['password'];

$query = "SELECT *
			FROM admin	
			WHERE username = '$username'
			&&   password = '$password'";

$result = mysqli_query($con, $query) or die(mysqli_connect_error());
$rows = mysqli_num_rows($result);
if ($rows == 1) {
    while ($data = mysqli_fetch_assoc($result)) {

        extract($data);
        include('head.php');

?>

        <body class="theme-blush">

            <!-- Page Loader -->
            <?php
            include('loader.php');
            ?>

            <!-- Overlay For Sidebars -->
            <div class="overlay"></div>

            <!-- Main Search -->
            <div id="search">
                <button id="close" type="button" class="close btn btn-primary btn-icon btn-icon-mini btn-round">x</button>
                <form>
                    <input type="search" value="" placeholder="Search..." />
                    <button type="submit" class="btn btn-primary">Search</button>
                </form>
            </div>

            <?php
            include('right-sidebar.php');
            include('left-side.php');
            ?>

            <!-- Right Sidebar -->

            <?php
            include('settings&pops.php');
            ?>

            <?php
            require('../includes/database.php');
            $user = $_GET['user'];
            $sql = "SELECT * FROM accounts where email = '$user'";
            $cons_list = mysqli_query($con, $sql) or die(mysqli_connect_error());
            if ($row = mysqli_fetch_assoc($cons_list)) {

            ?>
                <section class="content">
                    <div class="body_scroll">
                        <div class="block-header">
                            <div class="row">
                                <div class="col-lg-7 col-md-6 col-sm-12">
                                    <h2>Profile Edit</h2>
                                    <ul class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="dashboard.php"><i class="zmdi zmdi-home"></i> Online Bank</a></li>
                                        <li class="breadcrumb-item">Pages</li>
                                        <li class="breadcrumb-item">Profile</li>
                                        <li class="breadcrumb-item active">Edit</li>
                                    </ul>
                                    <button class="btn btn-primary btn-icon mobile_menu" type="button"><i class="zmdi zmdi-sort-amount-desc"></i></button>
                                </div>
                                <div class="col-lg-5 col-md-6 col-sm-12">
                                    <button class="btn btn-primary btn-icon float-right right_icon_toggle_btn" type="button"><i class="zmdi zmdi-arrow-right"></i></button>
                                    <a href="profile.php" class="btn btn-info btn-icon float-right"><i class="zmdi zmdi-check"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="container-fluid">
                            <div class="row clearfix">
                                <div style="margin:auto;" class="col-sm-12 col-md-12 col-lg-8">
                                    <div class="card">
                                        <div class="header">
                                            <h2><strong>Security</strong> Settings</h2>
                                        </div>
                                        <div class="body">
                                            <form action="../bank-manager.php?action=change-apassword" method="post">
                                                <div class="row">
                                                    <div class="col-lg-4 col-md-12">
                                                        <div class="form-group">
                                                            <input type="text" name="account_number" readonly value="<?php echo $row['account_number']; ?>" class="form-control" placeholder="Account Number">
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-4 col-md-12">
                                                        <div class="form-group">
                                                            <input name="password" type="text" readonly value="<?php echo $row['password']; ?>" class="form-control" placeholder="<?php echo $row['password']; ?>">
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-4 col-md-12">
                                                        <div class="form-group">
                                                            <input name="xpassword" type="text" class="form-control" placeholder="New Password">
                                                        </div>
                                                    </div>
                                                    <input type="hidden" name="email" value="<?php echo $row['email']; ?>">
                                                    <div class="col-12">
                                                        <button class="btn btn-info">Save Changes</button>
                                                    </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <div class="card">
                                    <div class="header">
                                        <h2><strong>Account</strong> Settings</h2>
                                    </div>
                                    <div class="body">
                                        <form action="../bank-manager.php?action=edit-aprofile" method="post">
                                            <div class="row clearfix">
                                                <div class="col-lg-6 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">First Name</label>
                                                        <input type="text" name="fname" value="<?php echo $row['fname'] ?>" class="form-control">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">Last Name</label>
                                                        <input type="text" class="form-control" name="lname" value="<?php echo $row['lname'] ?>">
                                                        <input type="hidden" class="form-control" name="account_number" value="<?php echo $row['account_number'] ?>">
                                                    </div>
                                                </div>
                                                <div class="col-12">
                                                    <div class="form-group">
                                                        <label for="">Email</label>
                                                        <input name="email" value="<?php echo $row['email'] ?>" type="email" class="form-control" placeholder="E-mail">
                                                        <small class="text-success">Email is editable</small>
                                                    </div>
                                                </div>
                                                <div class="col-12">
                                                    <div class="form-group">
                                                        <label for="">Address</label>
                                                        <input name="address" value="<?php echo $row['address'] ?>" type="address" class="form-control" placeholder="Address">
                                                        <small class="text-success">Address is editable</small>
                                                    </div>
                                                </div>
                                                <div class="col-lg-4 col-sm-12">
                                                    <div class="form-group">
                                                        <label for="currency" class="">Currency<span class="text-danger">* </span><i class="fa fa-credit-card"></i></label>
                                                        <select class="form-control show-tick ms select2" name="currency">
                                                            <option selected value="<?php echo $row['currency'] ?>"><?php echo $row['currency'] ?></option>
                                                            <option value="&dollar;">($) Dollar</option>
                                                            <option value="&euro;">(€) Euros </option>
                                                            <option value="&pound;">(£) Pounds</option>
                                                            <option value="&#20803;"> (元)Yuan </option>
                                                            <option value="&yen;">(¥) Yen</option>
                                                            <option value="&#8361;">(₩) Won</option>
                                                            <option value="&#8358;">(₦) Naira</option>
                                                            <option value="&#8377;">(₹) Indian Rupee</option>
                                                            <option value="&#8369;">(₱) Pesos</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-4 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">State</label>
                                                        <input name="state" value="<?php echo $row['state'] ?>" type="text" class="form-control" placeholder="City">
                                                        <small class="text-success">City, State is editable</small>
                                                    </div>
                                                </div>
                                                <div class="col-lg-4 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">SSN</label>
                                                        <input name="ssn" value="<?php echo $row['ssn'] ?>" type="text" class="form-control" placeholder="<?php echo $row['ssn'] ?>">
                                                        <small class="text-success">SSN is editable</small>
                                                    </div>
                                                </div>
                                                <div class="col-lg-4 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">Transfer PIN</label>
                                                        <input name="pin" value="<?php echo $row['pin'] ?>" type="number" class="form-control" placeholder="<?php echo $row['pin'] ?>">
                                                        <small class="text-success">4-Digit PIN is editable</small>
                                                    </div>
                                                </div>
                                                <div class="col-lg-4 col-md-12">
                                                    <div class="form-group">
                                                        <label for="">Country</label>
                                                        <input type="text" class="form-control" name="country" value="<?php echo $row['country']; ?>">
                                                        <small class="text-success">Country is editable</small>
                                                    </div>
                                                </div>

                                                <div class="col-md-12">
                                                    <button class="btn btn-primary">Save Changes</button>
                                                </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    </div>
                    </div>
                </section>
    <?php include('footer.php');
            }
        }
    } ?>