<!doctype html>
<html lang="en" translate="no" class="w-[640px] mx-auto md:w-full">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Recharge</title>
      <?php echo view('user/layout/head');?>
   </head>
   <style>
      .para
      {
      text-align:justify;
      color:#fff;
      }
      .ref-copy .copyLink {
      color:#fff;
      top: 50%;
      right: 25px;
      cursor: pointer;
      transform: translateY(-50%);
      }
      .ref-copy .copyLink:hover:after {
      opacity: 1;
      transform: translateY(0) translateX(-50%);
      }
      .ref-copy .copyLink:after {
      content: attr(tooltip);
      width: 140px;
      bottom: -13px;
      /* left: 50%; */
      padding: 5px;
      border-radius: 4px;
      font-size: 0.8rem;
      opacity: 0;
      pointer-events: none;
      position: absolute;
      background:linear-gradient(180deg, rgba(179,137,34,1) 0%, rgba(140,98,10,1) 50%, rgba(179,137,34,1) 100%, rgba(14,72,62,1) 100%);
      color: #000;
      transform: translateY(-10px) translateX(-50%);
      transition: all 300ms ease;
      text-align: center;
      }
      .referral .title p
      {
         font-size:13px;
      }

   </style>
   
   <?php 
   $user_ag = $_SERVER['HTTP_USER_AGENT'];

    if(preg_match('/(Mobile|Android|Tablet|GoBrowser|[0-9]x[0-9]*|uZardWeb\/|Mini|Doris\/|Skyfire\/|iPhone|Fennec\/|Maemo|Iris\/|CLDC\-|Mobi\/)/uis',$user_ag))
    {
    	$deviceType='mobile';
    }
    else
    {
    	$deviceType='computer';
    }
    ?>
    
    <?php 

    if($deviceType=='computer')
    {
    ?>
    <style>
     .referral .title
     {
         padding: 0px 64px;
     }
    </style>
    <?php 
    }
    else
    {
    ?>
    <style>
      .referral .title
     {
         padding: 0px;
     }
    </style>
    <?php 
    }
    ?>


   
   <body class="reg-overflow">
      <section class="dash-banner-bg banner-bg referral profile">
         <div class="container">
         <?php echo view('user/layout/header');?>
         <?php 
             use App\Libraries\MyEncrypt;
             use App\Helpers\site_helper;
             use App\Libraries\WalletCoreAPI;
            $this->session = \Config\Services::session();
            $this->db = db_connect();
            $coinid='1';
            $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
            $bal=str_replace(",","", $buy_bal);

            $public_data=$this->db->query("select * from payment_controls where payment_id='9' and payment_key='private_key'")->getRow();
            $private_data=$this->db->query("select * from payment_controls where payment_id='9' and payment_key='public_key'")->getRow();
            $private_key = $public_data->payment_value;
            $public_key = $private_data->payment_value;
            
            /*echo $public_key;
            echo "<BR>";
            echo $private_key;*/

            /*$walletcore = new WalletCoreAPI();
            $uusersid = $this->session->get('uusersid');
            $get_user_address=$this->db->query("select * from pay_address where userid='".$uusersid."'")->getRow();
            if($get_user_address)
            {  
                  $address=$get_user_address->address;
            }
            else
            {

              
               $ipn_url=base_url().'/ipn_verify';
               $walletcore->Setup($private_key,$public_key);
               $result = $walletcore->GetCallbackAddress("USDTTRC",$ipn_url);
               if($result['status'] == '200') 
               {
                     $address=$result['address'];
               }
               else
               {
                     $address='';
                     $error=$result['msg'];
               }

               if($address!='')
               {
                  $this->db->query("insert into pay_address set address='".$address."', userid='".$uusersid."',payment_id='9', date='".date("Y-m-d H:i:s")."'");
               }

            }*/
            $address='TNMfzPRXi9z31nVXeyZRNcFNPhyMiw16Pq';
         ?>
         <!---header end---->
         <!---banner start---->
         <div class="dash-wrap">
         <div class="title text-center py-2">
         <h2 class="text-primary">Recharge</h2>
         </div>
         <div class="row">
         <div class="col-lg-12">
         <div class="income-sec">
         <div class="total-income d-flex align-items-center">
         <div class="ref-content text-start">
         <h5 class="text-white">
         USDT Balance :<?php echo number_format($bal,4);?>USDT
         </h5>
         </div>
         </div>
         </div>
         <div class="text-center">
         <h3 class="text-white mt-5">Network Chain :<br> USDT (TRC20)</h3>
         </div>

         <?php 
         if($address!='')
         {
         ?>
         <br>
         <div class="qr-code text-center">
         <img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=<?php echo $address;?>" alt="deposit address" style="border:1px solid;margin-bottom:10px;">
         </div>
         <?php 
         }
         ?>
         </div>
         <div class="col-lg-12">
         <div class="title text-center">
         <div class="ref-form-list mt-5" >
         <div class="ref-form d-flex align-items-center">
         <?php 
         if($address!='')
         {
         ?>
         <div class="ref-content text-start">
         <p class="text-white mb-0">USDT Address</p>
         <h5 class="text-white" id="test" ><?php echo $address;?></h5>
         </div>
         <div class="ref-copy">
         <span class="copyLink text-decoration-none" id="copy" >
         <i class="fa-regular fa-copy"></i>
         </span>
         </div>
         <?php 
         }
         else
         {
            echo "<p style='color:red;'>".$error."</p>";
         }
         ?>
         </div>
         </div>
         </div>
       
         <div class="title para" style="margin-top:20px">
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon> Do not deposit any non-USDT (TRC20) assets to the above address, otherwise the assets will not be retrieved. </p>
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon> After recharging to the provided address, please confirm the entire network node. Your account will be credited after 3 network confirmations. </p>
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon>Minimum deposit amount: 1 USDT (TRC20). Deposits below the minimum amount will not be credited to the account and cannot be refunded. </p>
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon> Please note: transferring and recharging the block reward (Coinbase) is not supported, and such transfers will not be credited to your account. </p>
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon>Your recharge address will remain stable and will not change frequently; you can continue to recharge as usual. In the event of any changes, we will make every effort to notify you through website announcements or email. </p>
         <p> <iconify-icon icon="clarity:success-standard-solid" class="me-2"></iconify-icon> Please ensure the security of your computer and browser to prevent any tampering or leakage of information. </p>
         </div>
         </div>
         </div>
         </div>
         <?php echo view('user/layout/footer');?>
         </div>
      </section>
      <script type="text/javascript">
         const input = document.getElementById("test");
         console.log(input);
         const copyButton = document.getElementById("copy");
         const copyText = (e) => {
         var temp = $("<input>");
         $("body").append(temp);
         temp.val($(input).html()).select();
         document.execCommand("copy");
         e.currentTarget.setAttribute("tooltip", "Copied!");
         };
         const resetTooltip = (e) => {
         e.currentTarget.setAttribute("tooltip", "Copy to clipboard");
         };
         copyButton.addEventListener("click", (e) => copyText(e));
         copyButton.addEventListener("mouseover", (e) => resetTooltip(e));
      </script>
      <?php echo view('user/layout/footer-script');?>
   </body>
</html>