<?php 
session_start();
if(isset($_SESSION['SESS_ADMINLOGGEDIN']) == FALSE) {
    header("Location: " . $config_basedir."../admin/adminlogin.php");
}
require_once("achieved/config.php");
require_once("achieved/db.php");
require_once("achieved/functions.php");
require_once("header.php");
?>

<?php




    echo "<div class='main-panel'>
        <div class='content bg-light'>
            <div class='page-inner'>
            <div class='table-responsive'>";





if (isset($_POST['action'])) {
    
     $cname = mysql_real_escape_string($_POST['cname']); 
   $cphone = mysql_real_escape_string($_POST['cphone']);
    $cemail = mysql_real_escape_string($_POST['cemail']);
     $caddress = mysql_real_escape_string($_POST['caddress']);
     
     
     
     $email = mysql_real_escape_string($_POST['email']);
     $cur = mysql_real_escape_string($_POST['cur']);
       $coin = mysql_real_escape_string($_POST['coin']);
         $methid = mysql_real_escape_string($_POST['methid']);
           $username = mysql_real_escape_string($_POST['username']);
     $amount = mysql_real_escape_string($_POST['amount']);
     $log_id = mysql_real_escape_string($_POST['log_id']);
   
  
  
  
  
    $PUT = mysql_query("UPDATE logins SET balance=balance-$amount,tot_withdraw=tot_withdraw+$amount, withdraw=$amount, cwithdraw=cwithdraw+1,  confirmPAY=2 WHERE id='$log_id'");
    echo mysql_error();
    
    


    
    $success="<div plan='alert alert-success' style='margin-bottom:20px;'>Withdraw updated Successful<meta http-equiv='refresh' content='0; url=adminverify.php' /></div>";
   
      


}


   
  //   =============TO==USER=================  
       
    
       if(isset($email))
       {
          
          
           {
               
               $to = $email;
            $subject = 'WITHDRAW NOTIFICATION';
       
        $body ='
<table style="border-collapse: collapse; width: 98.7903%; height: 427px;" border="1">
<tbody>
<tr style="height: 219px;">
<td style="width: 100%; height: 219px;">
<h2 style="color: #222222; font-size: 19px; font-weight: normal; text-align: center;" align="left">WITHDRAWAL ALERT</h2>
<p style="text-align: center;"><br /><img id="alttext-image" style="text-align: -webkit-center; margin: 0px; display: inline; float: left;" src="'.$url.'/img/LOGO.png" width="100%" height="200" align="left" /><br /><br /><span id="alttext" style="text-align: -webkit-center;"></span></p>
</td>
</tr>
<tr style="height: 208px;">
<td style="width: 100%; height: 208px;">
<p style="font-family: Georgia, Time, sans-serif; font-size: 40px; color: #222222; line-height: 19px; margin: 0px; text-align: left;" align="center"><span class="specbundle2"><span class="font" style="font-size: 18px !important; line-height: 22px !important;">Your Account has been successfully debited with '.$cur.''.number_format($amount,2).' . You can now login to check your account summary.</span></span></p>
<p style="font-family: Georgia, Time, sans-serif; font-size: 40px; color: #222222; line-height: 19px; margin: 0px; text-align: left;" align="center">&nbsp;</p>
<p style="font-family: Georgia, Time, sans-serif; font-size: 40px; color: #222222; line-height: 19px; margin: 0px; text-align: left;" align="center"><span class="specbundle2"><span class="font" style="font-size: 18px !important; line-height: 22px !important;">Status:&nbsp;<strong style="color: #008000; text-decoration: underline;">successfully</strong></span></span></p>
<p style="text-align: left; font-family: Georgia,Time,sans-serif; font-size: 40px; color: #222222; font-weight: normal; line-height: 19px; margin: 0;" align="center"><span class="specbundle2"><span class="font" style="font-size: 18px !important; line-height: 22px !important;">Thanks...</span></span></p>
<p style="text-align: left; font-family: Georgia,Time,sans-serif; font-size: 40px; color: #222222; font-weight: normal; line-height: 19px; margin: 0;" align="center">&nbsp;</p>
<p style="text-align: left; font-family: Georgia,Time,sans-serif; font-size: 40px; color: #222222; font-weight: normal; line-height: 19px; margin: 0;" align="center">&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="35">
<div class="movableContent" style="padding-top: 0px; position: relative; margin: 0; border: 0px;">
<table style="height: 86px; width: 100%;" border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr style="height: 18px;">
<td style="height: 18px;" height="5">
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr style="height: 10px;">
<td style="height: 10px; width: 99.7951%;" align="center">
<p>&nbsp;</p>
<p><span class="specbundle2"><span class="font" style="font-size: 18px !important; line-height: 22px !important;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px;">Account Support Team</span></span></span></p>
<table style="height: 10px;">
<tbody>
<tr style="height: 10px;">
<td style="background-color: #dc2828; border-radius: 4px; padding: 15px 18px; height: 10px; width: 162.531px;" align="center" bgcolor="#1A54BA">
<div class="contentEditableContainer contentTextEditable" style="margin: 0;">
<div class="contentEditable" style="margin: 0;" align="center"><a class="link2" style="color: #ffffff; font-size: 16px; text-decoration: none;" href="'.$url.'" target="_blank" rel="noopener">Read more about us</a></div>
</div>
</td>
</tr>
</tbody>
</table>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left">&nbsp;</p>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left">&nbsp;</p>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left">&nbsp;</p>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left"><span class="font" style="font-size: 18px !important; line-height: 22px !important;">'.$cname.' service</span></p>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left"><span class="font" style="font-size: 18px !important; line-height: 22px !important;">'.$copyright.'</span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="height: 18px;">
<td style="height: 18px;" height="15">&nbsp;</td>
</tr>
<tr style="height: 19px;">
<td style="height: 10px;" align="left">&nbsp;</td>
</tr>
<tr style="height: 10px;">
<td style="height: 10px;" height="55">&nbsp;</td>
</tr>
<tr style="height: 10px;">
<td style="height: 10px;" align="center">&nbsp;</td>
</tr>
<tr style="height: 20px;">
<td style="height: 20px;" height="20">
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left">&nbsp;</p>
<p style="color: #cccccc; font-size: 12px; font-weight: normal; line-height: 20px; margin: 0px; text-align: center;" align="left">&nbsp;</p>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<table style="height: 5px; width: 0%;" border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 65px;">
<td style="height: 65px; width: 100%;" height="65">&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td style="border-bottom: 1px solid #dddddd; height: 18px; width: 100%;">&nbsp;</td>
</tr>
<tr style="height: 25px;">
<td style="height: 25px; width: 100%;" height="25">&nbsp;</td>
</tr>
<tr style="height: 24px;">
<td style="height: 24px; width: 100%;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
       ';
      
        $header = "From:". $cemail."\r\n";
       
        $header .= "MIME-Version: 1.0\r\n";
       
        $header .= "Content-Type: text/html; charset=UTF-8\r\n";
       
        if(@mail($to, $subject, $body, $header)){

}



}
}
?>  

              
                          
                    
                    
                    
                    
                    
                    <hr>
      
<?php if(isset($success)){
    echo $success;
}

if(isset($success)){
    echo"<body onload='goBack()'>";
}

?>
<script>
function goBack() {
  window.history.go(-2);
}
</script>
   
        
          
          
                        
                      
  <?php
  $id = $_GET['id'];
  $ordsql = "SELECT * from withdraw WHERE id = " . $id; 
$ordres = mysql_query($ordsql);
$ordrow = mysql_fetch_assoc($ordres);


if (isset($_POST['action'])) {
   
  $addresssql = mysql_query("UPDATE withdraw SET status=2  WHERE id='$id'");
    echo mysql_error();
    
}


               
      $id=$ordrow['id'];
$usersql = mysql_query("SELECT * FROM withdraw WHERE id='$id'");
while($userrow = mysql_fetch_assoc($usersql))         
               
       if($ordrow['status'] != 10)  {
            echo "
        
              <div class='main-panel'>
        <div class='content bg-light'>
            <div class='page-inner'>
                
                                <div class='table-responsive'>
             <table  id='myTable' class='table table-striped table-bordered'>
        
 <form action='' style='color: black;' class='reservation-form mb-0 bg-silver-deep p-30' method='post' >
 
    
    <input type='text' style='color: black;' class='form-control' name='log_id' value='".$ordrow['log_id']."' readonly/>
 
               
 

 
  <input type='hidden' class='form-control' name='cur' value='".$ordrow['cur']."' readonly/>
 
  
  <label style='color: black;'>E-mail</label>
 <input type='text' style='color: black;' class='form-control' name='email' value='".$ordrow['email']."' readonly/>
 
 
 <label style='color: black;'>Coim Wallet ID</label>
 <input type='text' style='color: black;' class='form-control' name='wallet' value='".$ordrow['wallet']."' readonly/>
 
 
 <label style='color: black;'>Method of Withdraw</label>
 <input type='text' style='color: black;' class='form-control' name='method' value='".$ordrow['method']."' readonly/>
 
 
  <label style='color: black;'>Withdrawal Amount</label>
 <input type='text' style='color: black;' class='form-control' name='amount' value='".$ordrow['amount']."' readonly/>
 
 
      
      ";
       }      
       
          
         

?>
        
        
        

             <?php
  $orderssql = "SELECT* from settings  ORDER BY id DESC";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);
   

 while($row = mysql_fetch_assoc($ordersres))
     {

echo"<input type='hidden' class='form-control' name='cname' id='details'  value='".$row['domain_name']."'>

<input type='hidden' class='form-control' name='cemail' id='details'  value='".$row['email2']."'>

<input type='hidden' class='form-control' name='cphone' id='details'  value='".$row['phone']."'>

<input type='hidden' class='form-control' name='caddress' id='details'  value='".$row['address']."'>
      
      
       
";

}
?>  <button type='submit' name='action' class='btn btn-success' id='btn-mlogin' >CONFIRM WITHDRAWAL </button>

        
     
     
     
     
         
    <?php
    
    

if (isset($_POST['decline'])) {
    
    
      $declinePAY = mysql_real_escape_string($_POST['declinePAY']);
      
      $log_id = mysql_real_escape_string($_POST['log_id']);
    
  $declinesql = mysql_query("UPDATE logins SET confirmPAY='$declinePAY' WHERE id='$log_id'");
    echo mysql_error();
    
    
    

    


    
    $declined="<div plan='alert alert-success' style='margin-bottom:20px;'>Withdraw Declined Successful<meta http-equiv='refresh' content='3; url=adminverify.php' /></div>";
   
      


}

?>
    
    <?php if(isset($declined)){
    echo $declined;
}
if(isset($declined)){
    echo"<body onload='goBack()'>";
}

?>
<script>
function goBack() {
  window.history.go(-2);
}
</script>
   



    
  
  
  
  
  
  
  
  
  
   <?php
  
  
  
  
  
  
  $id = $_GET['id'];
  $ordsql = "SELECT * from withdraw WHERE id = " . $id; 
$ordres = mysql_query($ordsql);
$ordrow = mysql_fetch_assoc($ordres);


if (isset($_POST['decline'])) {
   
  $addresssql = mysql_query("UPDATE withdraw SET status=3  WHERE id='$id'");
    echo mysql_error();
    
}


               
      $id=$ordrow['id'];
$usersql = mysql_query("SELECT * FROM withdraw WHERE id='$id'");
while($userrow = mysql_fetch_assoc($usersql))         
               
       if($ordrow['status'] != 3)  {
            echo "
        
 <form action='' class='reservation-form mb-0 bg-silver-deep p-30' method='post' >
      
       <input type='hidden' class='form-control' name='declinePAY' value='3' >
       
        <input type='hidden' class='form-control' name='log_id' value='".$ordrow['log_id']."' readonly/>
      
     
      <button type='submit' name='decline' class='btn btn-danger' id='btn-mlogin' >DECLINE WITHDRAWAL </button>  
        ";
       }
       ?>
        
        
        
        
         
        
        <br> <br> </form>   
        
        
        <br> <br> <hr>
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
            
            
    
              
              
           
             
             
       </div> </div>
            
        
        
        </div></div></div></div>
<br>
            <br>
        </div></div></div></div></div></div>
        
        
        
        <?php
require ("footer.php")
?>
