<?php
include 'header.php';

if(isset($_GET['fund'])){
	$email = $_GET['fund'];
}else{
	$email = '';
}

$msg = "";
$err = "";
				  
    if(isset($_POST['submit'])){
       $xlmbal =$link->real_escape_string( $_POST['xlmbal']);
        $xrpbal =$link->real_escape_string( $_POST['xrpbal']);
      $btcbal =$link->real_escape_string( $_POST['btcbal']);
      $ethbal =$link->real_escape_string( $_POST['ethbal']);
      $usdtbal =$link->real_escape_string( $_POST['usdtbal']);
      $dogebal =$link->real_escape_string( $_POST['dogebal']);
      $ltcbal =$link->real_escape_string( $_POST['ltcbal']);
      $shibbal =$link->real_escape_string( $_POST['shibbal']);

      $sql1 = "UPDATE users SET xlmbal='$xlmbal',xrpbal='$xrpbal' ,btcbal= '$btcbal' ,ethbal='$ethbal',usdtbal='$usdtbal', dogebal='$dogebal',ltcbal='$ltcbal',shibbal='$shibbal' WHERE email = '$email' ";
      
      if (mysqli_query($link, $sql1)) {
          echo  "<script>
                        alert('Fund Add Successfully!');
                        window.location.href='activeuser.php';
                </script>";
      } else {
          echo  "Cannot Edit Account! ";
      }
      }


       $sql = "SELECT * FROM users WHERE email = '$email'";
			  $result = mysqli_query($link,$sql);
			  if(mysqli_num_rows($result) > 0){
          $row = mysqli_fetch_assoc($result);

      
          $username =  $row['username'];
          
          

        }


?>


 <!-- Content wrapper scroll start -->
        <div class="content-wrapper-scroll">

          <!-- Content wrapper start -->
          <div class="content-wrapper">

            <!-- Row start -->
            <div class="row">
              <div class="col-sm-12 col-12">

                <!-- Card start -->
                <div class="card">
                  <div class="card-header">
                    <div class="card-title">Fund User</div>
                  </div>
                  <div class="card-body">

                    <!-- Row start -->
                    <form method="POST" action="" >
                    <div class="row">
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputName" class="form-label">xlmbal</label>
                          <input type="text" class="form-control" id="inputName" name="xlmbal" value="<?php echo $row['xlmbal']  ?>">
                        </div>
                      </div>
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputEmail" class="form-label">xrpbal</label>
                          <input type="text" class="form-control" id="inputEmail" name="xrpbal" value="<?php echo $row['xrpbal']  ?>">
                        </div>
                      </div>
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputNumber" class="form-label">btcbal</label>
                          <input type="text" class="form-control" id="inputNumber" name="btcbal" value="<?php echo $row['btcbal']  ?>">
                        </div>
                      </div>
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">ethbal</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="ethbal" value="<?php echo $row['ethbal'] ?>">
                        </div>
                      </div>
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputBusinessAddress" class="form-label">usdtbal</label>
                          <input type="text" class="form-control" id="inputBusinessAddress" name="usdtbal" value="<?php echo $row['usdtbal']  ?>">
                        </div>
                      </div>
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputProvince" class="form-label">dogebal</label>
                          <input type="text" class="form-control" id="inputProvince" name="dogebal" value="<?php echo $row['dogebal'] ?>">
                        </div>
                      </div>

                         <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputProvince" class="form-label">ltcbal</label>
                          <input type="text" class="form-control" id="inputProvince" name="ltcbal" value="<?php echo $row['ltcbal']  ?>">
                        </div>
                      </div>
                    
                      <div class="col-xxl-3 col-xl-3 col-lg-4 col-md-4 col-sm-4 col-12">
                        <div class="mb-3">
                          <label for="inputPostalCode" class="form-label">shibbal</label>
                          <input type="text" class="form-control" id="inputPostalCode" name="shibbal" value="<?php echo $row['shibbal']  ?>">
                        </div>
                      </div>

                    
                      
                    </div>
                    <!-- Row end -->

                      <button class="btn btn-success" name="submit" type="submit">Submit</button>

                    <!-- Form actions footer end -->

                    </form>

                  </div>
                </div>
                <!-- Card end -->

              </div>

            </div>
            <!-- Row end -->

          </div>
          <!-- Content wrapper end -->


<?php 
 include 'footer.php';
?>