<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php
    use App\Libraries\MyEncrypt;
    use App\Helpers\site_helper;
    use App\Libraries\WalletCoreAPI;

    $this->db = db_connect();
    $session = session();
    $this->common_model = model('CommonModel');
      echo view('user/common_style1');
    ?> 
<link rel="stylesheet" href="<?php echo base_url();?>styles/fonts/Socialico/stylesheet.css">
<link rel="stylesheet" href="<?php echo base_url();?>styles/css/set1.css">
<script src="<?php echo base_url();?>styles/js/modernizr.js"></script>
 <style>
  .contact_one .contact_left_content form input[type="text"]{border:0px;}
  .prfledit label, .prfledit label {
  padding-top: 10px;
}

.help-block {
    color: #eb5055;
    margin: 0em 0em 0em !important;
}
p.frgtpwd {

text-transform: none;
  }
  .profilesub ul li label{
  display: inline;
  color: #eb5055;
}
  </style>
        

</head>
  <body>
      <?php
        echo view('user/common_header');
        $currency_info = defaultcurrency();
      ?>
    <div class="col-lg-12">
      <div class="container trading_pairbg bg-white inner-box mt-3 px-3 py-4" style="overflow: auto;">
            <form class="steps-validation active" method="post" action="<?php echo $action;?>">
                <div class="profilesub clearfix profilesub2 mt-4">

          <div class="inner-title pb-3">
          <h6 class="color-2"><i class="fab fa-bitcoin"></i> Confirm Payment to Fuel</h6>
          </div>

                        <?php if($session->getFlashData('success_message')) 
                     {?>
                        <div class="row"><div class="col-lg-12 ">
                          <p class="frgtpwd frgtpwd1"><i class="fa fa-thumbs-up"></i><?php echo $session->getFlashData('success_message');?></p></div></div>
                    <?php } 
                          elseif ($session->getFlashData('error_message')) 
                          { ?>
                             <div class="row"><div class="col-lg-12">  <p class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo $session->getFlashData('error_message');?></p></div></div>
                    <?php } 
                          else { }?>
                       <div style="clear:both;"><br></div>
                       <?php
                        $id=$_SESSION["uusersid"];
                        $addr=$this->db->query("SELECT * FROM  key_tab WHERE uusersid=$id ORDER BY uusersid DESC LIMIT 1")->getResult();
                        $addrs=$addr[0];
                    ?>

                <div class="col-lg-12">
                  <div class="row">
                    <center>

              <div class="col-lg-8 ">
              <div class="pair-tab">
              <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist">

                    <?php 
                    if($form_deposit['payment_id']==9)
                    {
                       $ch = curl_init();

                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                        curl_setopt($ch, CURLOPT_URL,"https://currency.paykassa.pro/?api_currency_rate&currency_in=USDT&currency_out=BTC");
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
                        $result=curl_exec ($ch);
                        $getresponse = json_decode($result);
                        curl_close ($ch);
                        $currency_rate = $getresponse->data->value;
                        if($currency_rate)
                        {
                        $amount = $form_deposit['amount'];
                        }


?>
      <li class="nav-item col-lg-4" role="presentation">
      <h6 class="mont"><b><?php echo "Amount :";?></b></h6>                
      </li>
      <li class="col-lg-6">
      <span><?php echo $form_deposit['amount']." USDT";?></span>
      </li>   
      </ul>
      </div>
      </div>
      </div>
      <br>
      <br>

      <?


                       $private_key = $form_payment['public_key'];
                       $public_key = $form_payment['private_key'];
                       $walletcore = new WalletCoreAPI();
                       $walletcore->Setup($private_key,$public_key);
                        $ipn_url = "<?php echo base_url('ipn_process');?>";
                       $result = $walletcore->GetCallbackAddress("USDTTRC",$ipn_url);

                       if($result['status'] == '200') 
                       {
                            $address=$result['address'];
                       }
                       else
                       {
                            $error=$result['msg'];
                       }

                       if($address!='')
                       {
                            $this->db->query("insert into pay_address set address='".$address."', amount='".$form_deposit['amount']."',convert_amount='".$amount."',userid='".$form_deposit['uusersid']."',pay_mode='2',historyid='".$deposit_id."', payment_id='9', date='".date("Y-m-d H:i:s")."'");
                            $qr_url="https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=".$address;
                        ?>

                        <div class="row">
                                <div class="form-group col-sm-12">
                                    <center>
                                        <h4>Payment Address: <?php echo $address;?></h4>
                                        <div style="clear:both;"><br></div>
                                         <img src="<?php echo $qr_url;?>">
                                         <div style="clear:both;"><br></div>
                                     </center>
                                </div>
                            </div>        
                    <?php
                            }

                          }
                    ?>
                    
              <div style='clear:both;'><br></div>

                <div class="cmmn col-lg-12">   
                    <div class="contact_page_btn">                        
                        <span style="text-align:center;"><h6>After Successful payment, Your Fuel Amount Will be Added.</h6></span>
                    </div>
                </div> 
                  </div>
                  <?php
                  echo view('user/res_check');
                  ?>

            </form>
        </div>
    </div>
    <div style="clear:both;"><br></div>
  </center>
</div>
</div>
</div>
    <?php
      echo view('user/footer1');
      echo view('user/common_script');
  // echo view('user/getResult_check');
?>
</body>
</html>
