<?php
session_start();
ob_start();
include('includes/config.php');
if($_SESSION['name'] == '')
 {
     header("location:index.php");
 }
    else{
   
	
	if(isset($_POST['information_submit'])!=''){
	$userid=$_POST['user'];
	$mobile=$_POST['mobile'];
	$email=$_POST['email'];
	$password=$_POST['password'];
	$status=$_POST['status'];
	$pass = md5($password);
//	echo $userid  ; exit;
$sqluser= mysqli_query($com,"UPDATE loginuser SET mobile='$mobile',email='$email',password='$pass',show_password='$password',status='$status' WHERE id= '$userid'");
echo "<script>
alert('Update Success');
window.location.href='Userlist.php';
</script>";
	}
	
	if(isset($_POST['bank_submit'])!=''){
	$userid=$_POST['user'];
	$name=$_POST['name'];
	$ifsc=$_POST['ifsc'];
	$bank_name=$_POST['bank_name'];
	$acc_no=$_POST['acc_no'];
	$upi=$_POST['upi'];
	
$sqlbank= mysqli_query($com,"UPDATE bankdetail SET name='$name',ifsc='$ifsc',bankname='$bank_name',account='$acc_no',upi_name='$upi' WHERE id= '$userid'");
echo "<script>
alert('Update Success');
window.location.href='Userlist.php';
</script>";
	}
        ?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Forcecrypto Admin </title>
        <link rel="stylesheet" href="css/bootstrap.min.css" media="screen" >
        <link rel="stylesheet" href="css/font-awesome.min.css" media="screen" >
        <link rel="stylesheet" href="css/animate-css/animate.min.css" media="screen" >
        <link rel="stylesheet" href="css/lobipanel/lobipanel.min.css" media="screen" >
        <link rel="stylesheet" href="css/prism/prism.css" media="screen" >
        <link rel="stylesheet" href="css/select2/select2.min.css" >
        <link rel="stylesheet" href="css/main.css" media="screen" >
        <script src="js/modernizr/modernizr.min.js"></script>
    </head>
    <body class="top-navbar-fixed">
        <div class="main-wrapper">

            <!-- ========== TOP NAVBAR ========== -->
  <?php include('includes/topbar.php');?> 
            <!-- ========== WRAPPER FOR BOTH SIDEBARS & MAIN CONTENT ========== -->
            <div class="content-wrapper">
                <div class="content-container">

                    <!-- ========== LEFT SIDEBAR ========== -->
                   <?php include('includes/leftbar.php');?>  
                    <!-- /.left-sidebar -->

                    <div class="main-page">

                     <div class="container-fluid">
                            <div class="row page-title-div">
                                <div class="col-md-6">
                                    <h2 class="title">User Personal Informattion</h2>
                                
                                </div>
                                
                                <!-- /.col-md-6 text-right -->
                            </div>
                            <!-- /.row -->
                            <div class="row breadcrumb-div">
                                <div class="col-md-6">
                                    
                                </div>
                             
                            </div>
                            <!-- /.row -->
                        </div>
                        <div class="container-fluid">
                           
                        <div class="row">
                                    <div class="col-md-12">
                                        <div class="panel">
                                            <div class="panel-heading">
                                                <div class="panel-title">
                                                    <h5></h5>
                                                </div>
                                            </div>
                                            <div class="panel-body">
<?php if($msg){?>
<div class="alert alert-success left-icon-alert" role="alert">
 <strong>Well done!</strong><?php echo htmlentities($msg); ?>
 </div><?php } 
else if($error){?>
    <div class="alert alert-danger left-icon-alert" role="alert">
                                            <strong>Oh snap!</strong> <?php echo htmlentities($error); ?>
                                        </div>
                                        <?php } ?>
                                        <h1>Personal Informattion</h1>
                                                 <form  method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">
<?php
       $userid = $_GET['user'];
       $Query=mysqli_query($com,"select * from `loginuser` where id='$userid'");
       
       $row=mysqli_fetch_array($Query);
       
       ?>  
<div class="form-group">
<label for="default" class="col-sm-6 control-label">Mobile</label>
<div class="col-sm-6">
<input type="text" name="mobile" class="form-control" placeholder="" value="<?php echo $row['mobile'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">Email</label>
<div class="col-sm-6">
<input type="text" name="email" class="form-control" placeholder="" value="<?php echo $row['email'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">Password</label>
<div class="col-sm-6">
<input type="text" name="password" class="form-control" placeholder="" value="<?php echo $row['show_password'];   ?>" >
</div>
</div>
                                              
                                                    <div class="form-group">
                                                        <div class="col-sm-offset-6 col-sm-6">
                                                            <input type="hidden" class="form-control" name="user" placeholder="" value="<?php echo $_GET['user'];   ?>" >
                                                            <button type="submit" name="information_submit" class="btn btn-primary">Update User Info</button>
                                                        </div>
                                                    </div>
                                                </form>

<br>
<br>
<br>
<br>
<h1>User Bank Informattion</h1>
  <form  method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">
<?php
       $userid = $_GET['user'];
       $Query1=mysqli_query($con,"select * from `bankdetail` where id='$userid'");
       
       $row1=mysqli_fetch_array($Query1);
       
       ?> 
       <br>
<div class="form-group">
<label for="default" class="col-sm-6 control-label">Name</label>
<div class="col-sm-6">
<input type="text" name="name" class="form-control" placeholder="" value="<?php echo $row1['name'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">IfSC</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ifsc" placeholder="" value="<?php echo $row1['ifsc'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">Bank Name</label>
<div class="col-sm-6">
 <input type="text" class="form-control" name="bank_name" placeholder="" value="<?php echo $row1['bankname'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">Account Number</label>
<div class="col-sm-6">
 <input type="number" class="form-control" name="acc_no" placeholder="" value="<?php echo $row1['account'];   ?>" >
</div>
</div>

<div class="form-group">
<label for="default" class="col-sm-6 control-label">UPI Address</label>
<div class="col-sm-6">
 <input type="text" class="form-control" name="upi" placeholder="" value="<?php echo $row1['upi_name'];   ?>" >
</div>
</div>
                                              
                                                    <div class="form-group">
                                                        <div class="col-sm-offset-6 col-sm-6">
                                                            <input type="hidden" class="form-control" name="user" placeholder="" value="<?php echo $_GET['user'];   ?>" >
                                                            <button type="submit" name="bank_submit" class="btn btn-primary">Update Bank Info</button>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- /.col-md-12 -->
                                </div>
                    </div>
                </div>
                <!-- /.content-container -->
            </div>
            <!-- /.content-wrapper -->
        </div>
        <!-- /.main-wrapper -->
        <script src="js/jquery/jquery-2.2.4.min.js"></script>
        <script src="js/bootstrap/bootstrap.min.js"></script>
        <script src="js/pace/pace.min.js"></script>
        <script src="js/lobipanel/lobipanel.min.js"></script>
        <script src="js/iscroll/iscroll.js"></script>
        <script src="js/prism/prism.js"></script>
        <script src="js/select2/select2.min.js"></script>
        <script src="js/main.js"></script>
        <script>
            $(function($) {
                $(".js-states").select2();
                $(".js-states-limit").select2({
                    maximumSelectionLength: 2
                });
                $(".js-states-hide").select2({
                    minimumResultsForSearch: Infinity
                });
            });
        </script>
    </body>
</html>
<?PHP } ?>
