<?php
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include'dbconnection.php';
//Checking session is valid or not
if (strlen($_SESSION['id']==0)) {
  header('location:logout.php');
  } else{

// for updating user info    
if(isset($_POST['Submit']))
{
	$name=$_POST['name'];
	$email=$_POST['email'];
  $country=$_POST['country'];
  $number=$_POST['number'];
  $deposit=$_POST['deposit'];
  $bonus=$_POST['bonus'];
  $balance=$_POST['balance'];
  $profit=$_POST['profit'];
  $kyc=$_POST['kyc'];
	$password=$_POST['password'];
  $uid=intval($_GET['uid']);
$query=mysqli_query($con,"update user set name='$name', email='$email', country='$country', number='$number', deposit='$deposit', bonus='$bonus', balance='$balance', profits='$profit', kyc='$kyc', password='$password' where id='$uid'");
$_SESSION['msg']="Profile Updated successfully";
}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>Admin | Update Profile</title>
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">
  </head>

  <body>

  <section id="container" >
      <header class="header black-bg">
              <div class="sidebar-toggle-box">
                  <div class="fa fa-bars tooltips" data-placement="right" data-original-title="Toggle Navigation"></div>
              </div>
            <a href="#" class="logo"><b>Admin Dashboard</b></a>
            <div class="nav notify-row" id="top_menu">
               
                         
                   
                </ul>
            </div>
            <div class="top-menu">
            	<ul class="nav pull-right top-menu">
                    <li><a class="logout" href="logout.php">Logout</a></li>
            	</ul>
            </div>
        </header>
      <aside>
          <div id="sidebar"  class="nav-collapse ">
              <ul class="sidebar-menu" id="nav-accordion">
              
              	  <p class="centered"><a href="#"><img src="assets/img/ui-sam.jpg" class="img-circle" width="60"></a></p>
              	  <h5 class="centered"><?php echo $_SESSION['login'];?></h5>
              	  	
                  <li class="mt">
                      <a href="change-password.php">
                          <i class="fa fa-file"></i>
                          <span>Change Password</span>
                      </a>
                  </li>

                  <li class="sub-menu">
                      <a href="manage-users.php" >
                          <i class="fa fa-users"></i>
                          <span>Manage Users</span>
                      </a>
                   
                  </li>
                   <li class="sub-menu">
                      <a href="copytrade.php" >
                          <i class="fa fa-users"></i>
                          <span>Copy Trading</span>
                      </a>
                   
                  </li>
                   <li class="sub-menu">
                      <a href="trading.php" >
                          <i class="fa fa-users"></i>
                          <span>Trading</span>
                      </a>
                   
                  </li>

                  <li class="sub-menu">
                      <a href="plans.php" >
                          <i class="fa fa-users"></i>
                          <span>Plans</span>
                      </a>
                   
                  </li>
              
                 
              </ul>
          </div>
      </aside>
      <?php $ret=mysqli_query($con,"select * from user where id='".$_GET['uid']."'");
	  while($row=mysqli_fetch_array($ret))
	  
	  {?>
      <section id="main-content">
          <section class="wrapper">
          	<h3><i class="fa fa-angle-right"></i> <?php echo $row['name'];?>'s Information</h3>
             	
				<div class="row">
				
                  
	                  
                  <div class="col-md-12">
                      <div class="content-panel">
                      <p align="center" style="color:#F00;"><?php echo $_SESSION['msg'];?><?php echo $_SESSION['msg']=""; ?></p>
                           <form class="form-horizontal style-form" name="form1" method="post" action="" onSubmit="return valid();">
                           <p style="color:#F00"><?php echo $_SESSION['msg'];?><?php echo $_SESSION['msg']="";?></p>
                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">User Name </label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="name" value="<?php echo $row['name'];?>" readonly>
                              </div>
                          </div>
                          
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Email</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="email" value="<?php echo $row['email'];?>" readonly>
                              </div>
                          </div>
                          
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Country</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="country" value="<?php echo $row['country'];?>" readonly >
                              </div>
                            </div>

                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Number</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="number" value="<?php echo $row['number'];?>" readonly >
                              </div>
                            </div>

                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Deposit</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="deposit" value="<?php echo $row['deposit'];?>"  >
                              </div>
                            </div>
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Bonus</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="bonus" value="<?php echo $row['bonus'];?>"  >
                              </div>
                            </div>
                            <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Balance</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="balance" value="<?php echo $row['balance'];?>"  >
                              </div>
                            </div>
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Profit</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="profit" value="<?php echo $row['profits'];?>"  >
                              </div>
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">KYC</label>
                              <div class="col-sm-10">
                                  <select required name= "kyc" class="form-control">
                                      <option value="">KYC Status</option>
                                      <option value="Unverified">Unverified</option>
                                      <option value="Pending">Pending</option>
                                      <option value="Verified">Verified</option>
                                  </select>
                              </div>
                            </div>
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Password</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="password" value="<?php echo $row['password'];?>"  >
                              </div>
                            </div>

                          </div>
                             
                            
                          <div style="margin-left:100px;">
                          <input type="submit" name="Submit" value="Update" class="btn btn-theme"></div>
                          </form>
                      </div>
                  </div>
              </div>
		</section>
        <?php } ?>
      </section></section>
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="assets/js/common-scripts.js"></script>
  <script>
      $(function(){
          $('select.styled').customSelect();
      });

  </script>

  </body>
</html>
<?php } ?>